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

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
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,222,248
Messages
6,164,814
Members
451,918
Latest member
Pinnacleinfotechcad

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