Moving the cursor in a Textbox on a Userform

_Ken_

Board Regular
Joined
Jul 26, 2002
Messages
53
Hi,
Can anybody offer any advice, I have a Userform with a TextBox, where the user enters a couple of numbers (to do a search) however, on clicking CommandButton1, I want the cursor to jump to the end of the text in the TextBox and insert a * .
So in other words, how do I implement 'CTL-END' into a macro?

Ken
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Perhaps:

Code:
Private Sub CommandButton1_Click()
Dim t As String
t = TextBox1.Text
If Len(t) > 0 And Right(t, 1) <> "*" Then TextBox1.Text = t & "*"
TextBox1.SetFocus
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,706
Members
449,049
Latest member
THMarana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top