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

You want to use the Initialize event for the userform.
The code would be something like this:

Private Sub UserForm_Initialize()
TextBox1.Text = Worksheets("Sheet1").Range("A1").Value
End Sub

You will need to use the actual names for your textbox and
worksheet.
-----Original Message-----
Dear VBA Experts,

I have a UserForm where I want to have a textbox

populated
with an amount in a cell. I have tried the ControlSource
= the cell or the Value = the cell and am getting an

error
message. Assuming I have a number in cell A1, what is

the
code to have that info populate a textbox in a userform

so
that when the userform is opened, the textbox already
shows that amount? Thanks in advance.

Neal
.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Populating Textbox in UserForm

Derek,

I inserted the code you provided and it is still not
working. I am using a Click Button to call up the
UserForm. How does it know to Initialize the UserForm?
Could you give an example? Thanks.

Neal


-----Original Message-----
You want to use the Initialize event for the userform.
The code would be something like this:

Private Sub UserForm_Initialize()
TextBox1.Text = Worksheets("Sheet1").Range("A1").Value
End Sub

You will need to use the actual names for your textbox

and
worksheet.
-----Original Message-----
Dear VBA Experts,

I have a UserForm where I want to have a textbox

populated
with an amount in a cell. I have tried the

ControlSource
= the cell or the Value = the cell and am getting an

error
message. Assuming I have a number in cell A1, what is

the
code to have that info populate a textbox in a userform

so
that when the userform is opened, the textbox already
shows that amount? Thanks in advance.

Neal
.

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Populating Textbox in UserForm

when an object is instantiated/created, the initialize event is run. That
is part of the internal code that is involved with managing the object.

The Initialize event must be placed in the module associated with the
userform.

The code he provided was an example.

Regards,
Tom Ogilvy

"Neal" wrote in message
...
Derek,

I inserted the code you provided and it is still not
working. I am using a Click Button to call up the
UserForm. How does it know to Initialize the UserForm?
Could you give an example? Thanks.

Neal


-----Original Message-----
You want to use the Initialize event for the userform.
The code would be something like this:

Private Sub UserForm_Initialize()
TextBox1.Text = Worksheets("Sheet1").Range("A1").Value
End Sub

You will need to use the actual names for your textbox

and
worksheet.
-----Original Message-----
Dear VBA Experts,

I have a UserForm where I want to have a textbox

populated
with an amount in a cell. I have tried the

ControlSource
= the cell or the Value = the cell and am getting an

error
message. Assuming I have a number in cell A1, what is

the
code to have that info populate a textbox in a userform

so
that when the userform is opened, the textbox already
shows that amount? Thanks in advance.

Neal
.

.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Populating Textbox in UserForm

Derek and Tom,

My fault. I messed up on the first line where it said
userform_initialize and had userform2_initialize. You
two, of course, were right. Thanks for the info and
clarification. It works!!

Neal

-----Original Message-----
when an object is instantiated/created, the initialize

event is run. That
is part of the internal code that is involved with

managing the object.

The Initialize event must be placed in the module

associated with the
userform.

The code he provided was an example.

Regards,
Tom Ogilvy

"Neal" wrote in message
...
Derek,

I inserted the code you provided and it is still not
working. I am using a Click Button to call up the
UserForm. How does it know to Initialize the UserForm?
Could you give an example? Thanks.

Neal


-----Original Message-----
You want to use the Initialize event for the userform.
The code would be something like this:

Private Sub UserForm_Initialize()
TextBox1.Text = Worksheets("Sheet1").Range

("A1").Value
End Sub

You will need to use the actual names for your textbox

and
worksheet.
-----Original Message-----
Dear VBA Experts,

I have a UserForm where I want to have a textbox
populated
with an amount in a cell. I have tried the

ControlSource
= the cell or the Value = the cell and am getting an
error
message. Assuming I have a number in cell A1, what is
the
code to have that info populate a textbox in a

userform
so
that when the userform is opened, the textbox already
shows that amount? Thanks in advance.

Neal
.

.



.

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
WordWrap a TextBox on a UserForm dcornett63 Excel Discussion (Misc queries) 2 April 22nd 10 09:35 PM
Userform with textbox displaying Cell B1 Value JMay Excel Discussion (Misc queries) 2 October 4th 09 12:56 AM
Add COUNTIF TO USERFORM TEXTBOX Richhall[_2_] Excel Worksheet Functions 4 September 16th 09 11:43 AM
Userform with 5 textbox and 1 needs to refresh to have total funkymonkUK Excel Discussion (Misc queries) 1 February 17th 05 01:45 AM
userform textbox Phil Excel Worksheet Functions 5 January 16th 05 06:59 PM


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