Populating Textbox in UserForm

D

Derek

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.
 
N

Neal

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
 
T

Tom Ogilvy

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
 
N

Neal

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top