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

I have fifteen text boxes in my userform. They have a default value of
zero. When my form loads, the first text box has the focus. I want to
highlight or select the zero so when I enter a number into the text box
it will overwrite the zero rather then put the number after the zero. I
can't figure out the code I need to highlight the zero.

The following text boxes highlight the zero automatically when I press
enter in the previous text boxes. So I just need to be able select the
first text boxes zero. Any help will be appreciated. Thanks in advance.
By the way I have excel 2003. Thanks, Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default UserForm Control Question

This UserForm Initialize event code should do what you want...

Private Sub UserForm_Initialize()
With TextBox1
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub

--
Rick (MVP - Excel)


"Mark Knutson" wrote in message
...
I have fifteen text boxes in my userform. They have a default value of
zero. When my form loads, the first text box has the focus. I want to
highlight or select the zero so when I enter a number into the text box it
will overwrite the zero rather then put the number after the zero. I can't
figure out the code I need to highlight the zero.

The following text boxes highlight the zero automatically when I press
enter in the previous text boxes. So I just need to be able select the
first text boxes zero. Any help will be appreciated. Thanks in advance. By
the way I have excel 2003. Thanks, Mark


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
Selecting control on userform with part of control name (set question) Keith Excel Programming 4 January 10th 07 02:24 PM
Quick syntax question- bolding userform control text via VBA Keith Excel Programming 2 January 8th 07 03:39 AM
Control Sequence from Userform Control Nigel Excel Programming 3 December 29th 04 01:25 PM
Flow of control in VBA Question - Userform Interaction Alan Excel Programming 3 December 23rd 04 01:12 PM
Userform control ZMore Excel Programming 1 March 5th 04 11:34 PM


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