View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_566_] Leith Ross[_566_] is offline
external usenet poster
 
Posts: 1
Default highlighted text


Hello MD,

Copy and paste this code into a standard VBA Module.

To add a Module to project:
1) Press Alt + F11 in Excel to open the VB Editor
2) Press Alt + I to activate the Insert menu
3) Press M to add a Module

Public Sub HighlightTextBox(TextBox_Name As String)

'Highlight TextBox Text

With UserForms(0).Controls(TextBox_Name)
..SetFocus
..SelStart = 0
..SelLength = Len(.Text)
End With

End Sub


Calling the Macro:
Enclose the name of the TextBox whose text you want to highlight in
quotes.

HighlightTextBox "txtbox1"


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=546556