Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
highlighting or selecting cells joec[_2_] Setting up and Configuration of Excel 1 August 19th 09 10:11 PM
VLOOKUP selecting, not highlighting Alexander Bryant Excel Worksheet Functions 0 July 4th 08 01:07 AM
finding data entry required cells by highlighting. gtslabs Excel Discussion (Misc queries) 6 October 12th 07 10:41 PM
Syntax for selecting a textbox within a chart? tenlbham Charts and Charting in Excel 4 April 25th 07 02:39 AM
Selecting/Highlighting active cells wnfisba Excel Discussion (Misc queries) 1 September 27th 06 04:24 PM


All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"