Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Setting initial value on text box?

Does anyone know how to set an initial value on a text box? I want
to go to a specific place on my worksheet and get the value that will
be the initial value and put it into the form that the user will then
either keep or change.

I read a post saying to use a private sub_initialize in my userform
code section that excel created for me and I put this code into it but
the value of Loc never shows up in the actual userform when I run my
code.

Private Sub UserForm1_Initialize()
Dim Loc As Range
Set Loc = Worksheets("Internals").Range("B4").CurrentRegion
TextBox1.Text = Loc
End Sub

Thanks,
Chet

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Setting initial value on text box?

Private Sub UserForm_Activate()
TextBox1.Text = Worksheets("Internals").Range("B4")
End Sub

Hth,
Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Setting initial value on text box?

A non-VBA way of doing this would be simply to set the "ControlSource"
of the TextBox to a named range. The default downside here (or upside,
depending on what you want) is that any change to the value in the
textbox would also change the value in the cell. To prevent that
automatic update behavior, you can set the 'Enabled' property of the
textbox to 'False'

/ Tyla /


On Mar 20, 2:35 pm, "merjet" wrote:
Private Sub UserForm_Activate()
TextBox1.Text = Worksheets("Internals").Range("B4")
End Sub

Hth,
Merjet



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
setting up conditional text input guy325 Excel Discussion (Misc queries) 4 December 3rd 09 11:56 PM
Text format - setting text colour with code NDBC Excel Discussion (Misc queries) 6 July 1st 09 10:15 PM
Setting the Chart name as the text from a cell. Sareh Excel Programming 2 July 17th 06 07:41 PM
Remove middle initial from "first name middle initial" Justin F. Excel Discussion (Misc queries) 15 September 26th 05 06:13 PM
Text Box - Setting Values jaf Excel Programming 1 August 20th 03 10:40 PM


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