Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Highlight Value of Text Box

I have a UserForm with four textboxes names py1 py2 py3 py4
What I am trying to accomplish is that when a user clicks into a textbox, it
will loop through the other three add their values and subtract it from a
Total, and put that value into the textbox. This part I have accomplished
with no problem.
However when it puts that value into the textbox the user has clicked into i
want to HIGHLIGHT the value that was entered into textbox through VBA

..selstart & .sellength will not select it code follows


Private Sub py1_Enter()
Dim t As Integer
toy = 0
Set ctl1 = Me.ActiveControl
For t = 1 To 4
Set ctll = Me.Controls("py" + Trim(Str(t)))
If ctl1.Name < ctll.Name Then toy = toy + Val(ctll.Text)
Next
With ctl1
..Text = Trim(Str(tow - toy))
..SelStart = 0
..SelLength = Len(.Text)
End With
End Sub

the code is EXACTLY the same for each text box
the two variables ctll & ctl1 are public in the userform.
anyone see why maybe the userform will not highlight the text?


--
When you lose your mind, you free your life.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Highlight Value of Text Box


Hi i think you need to SetFocus = Textbox? or something along thos
lines

Simo

--
Simon Lloy
-----------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670
View this thread: http://www.excelforum.com/showthread.php?threadid=37868

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
Highlight specific text jlr Excel Discussion (Misc queries) 1 May 6th 10 07:21 PM
No Text Highlight in Excel ?? Ean Wilson Excel Discussion (Misc queries) 10 October 15th 07 01:11 PM
Highlight text mykaltx Excel Discussion (Misc queries) 2 July 28th 05 10:28 PM
Text Highlight Paul Mak Excel Programming 6 May 4th 05 09:48 PM
highlight cell text jim Excel Programming 8 February 13th 04 06:00 PM


All times are GMT +1. The time now is 05:03 AM.

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"