View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sir Tom Sir Tom is offline
external usenet poster
 
Posts: 4
Default Move the cursor to end of data in textbox

I'm using Excel 2000 and creating some user forms.
The form has a phone number textbox that I have added code to vailidate the
phone and put it in a certian format (xxx)xxx-xxxx)
I have set textbox on Enter event to write "(" before the user start typnig
the phone number.
If you click into the textbox the cursor moves to end okay.
If you tab into the textbox in highligthts the ( and when the user starts
typing it erases the ( .

Private Sub tbGBPhone_Enter()
Dim Somedata
' If Phone not correct length
If Len(tbGBPhone.Value) 13 Or Len(tbGBPhone.Value) < 13 Then

tbGBPhone.Value = "("
End If
End Sub


I have tried SelLength or SelStart properties, but that didn't work.

How do I make the cursor advance to the end ??