Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Highlighting or Selecting TextBox entry
In attempting to trap bad data (for the application) being entered into text
boxes from a form, the exit event of the private sub works well to identify the problem and return focus to the text box. However, I am not able to take it a step further and actually highlight (or select) the errant text for correction. The SelText property doesn't seem to work, or I'm not applying it correctly. Thanks, Gus |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Highlighting or Selecting TextBox entry
Gus,
Do you mean something like Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) If TextBox1.Text < "Bob" Then TextBox1.SelStart = 0 TextBox1.SelLength = Len(TextBox1.Text) Cancel = True End If End Sub -- HTH Bob Phillips "Gus Gazepis" wrote in message ... In attempting to trap bad data (for the application) being entered into text boxes from a form, the exit event of the private sub works well to identify the problem and return focus to the text box. However, I am not able to take it a step further and actually highlight (or select) the errant text for correction. The SelText property doesn't seem to work, or I'm not applying it correctly. Thanks, Gus |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Highlighting or Selecting TextBox entry
Bob,
A thousand thanks! The code works perfectly. I really appreciate the help. Thanks again, Gus Gazepis Bob Phillips wrote in message ... Gus, Do you mean something like Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) If TextBox1.Text < "Bob" Then TextBox1.SelStart = 0 TextBox1.SelLength = Len(TextBox1.Text) Cancel = True End If End Sub -- HTH Bob Phillips "Gus Gazepis" wrote in message ... In attempting to trap bad data (for the application) being entered into text boxes from a form, the exit event of the private sub works well to identify the problem and return focus to the text box. However, I am not able to take it a step further and actually highlight (or select) the errant text for correction. The SelText property doesn't seem to work, or I'm not applying it correctly. Thanks, Gus |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Highlighting or Selecting TextBox entry
Thanks Gus, glad to be of help.
Bob "Gus Gazepis" wrote in message ... Bob, A thousand thanks! The code works perfectly. I really appreciate the help. Thanks again, Gus Gazepis Bob Phillips wrote in message ... Gus, Do you mean something like Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) If TextBox1.Text < "Bob" Then TextBox1.SelStart = 0 TextBox1.SelLength = Len(TextBox1.Text) Cancel = True End If End Sub -- HTH Bob Phillips "Gus Gazepis" wrote in message ... In attempting to trap bad data (for the application) being entered into text boxes from a form, the exit event of the private sub works well to identify the problem and return focus to the text box. However, I am not able to take it a step further and actually highlight (or select) the errant text for correction. The SelText property doesn't seem to work, or I'm not applying it correctly. Thanks, Gus |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
highlighting or selecting cells | Setting up and Configuration of Excel | |||
VLOOKUP selecting, not highlighting | Excel Worksheet Functions | |||
finding data entry required cells by highlighting. | Excel Discussion (Misc queries) | |||
Syntax for selecting a textbox within a chart? | Charts and Charting in Excel | |||
Selecting/Highlighting active cells | Excel Discussion (Misc queries) |