Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Highlighting Textbox

I have a userform with a Textbox that starts off with an initial value
read in from a cell.

After taking the user to the textbox I want the value withing it to be
highlighted.

This code does not solve it..

_______________________________________

Private Sub UserForm_Initialize()
TextBox1.Text = Worksheets("blad1").Cells(5, 1)
TextBox1.SetFocus
End Sub
_______________________________________

Any ideas?

Garry Jones
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Highlighting Textbox

Garry,

If you want to highlight (select) the text in a textbox, use the SelStart
and SelLength properties. E.g.,

With Userform1.TextBox1
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com

"Garry Jones" wrote in message
...
I have a userform with a Textbox that starts off with an initial value
read in from a cell.

After taking the user to the textbox I want the value withing it to be
highlighted.

This code does not solve it..

_______________________________________

Private Sub UserForm_Initialize()
TextBox1.Text = Worksheets("blad1").Cells(5, 1)
TextBox1.SetFocus
End Sub
_______________________________________

Any ideas?

Garry Jones



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
Calculate Textbox value based on another textbox value.doc Tdungate Excel Discussion (Misc queries) 1 February 12th 09 07:11 PM
Calculate Textbox value based on another textbox value Tdungate Excel Discussion (Misc queries) 0 February 12th 09 07:03 PM
Highlighting blanks via GO TO SPECIAL is not highlighting blank cells - HELP, I'm totally stuck. Jamie Furlong Excel Discussion (Misc queries) 6 August 28th 05 09:27 PM
Highlighting or Selecting TextBox entry Gus Gazepis Excel Programming 3 September 8th 03 12:01 AM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 04:26 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"