Change one label in another form

S

Scott

I want to change a label in another form based on the user input from the
main form. Here is what I have tried but failed:
On the main form, the user choose "Good morning", "Good afternoon" or "Good
evening". The content is linked to a cell (say "A1") on Sheet1. Then the main
form is closed and another form, say UserForm1 is called. I want one label on
UserForm1 to show "Good morning", "Good afternoon" or "Good evening" based on
the input of the main form. On the main form I tried
UserForm1.show
UserForm1.Label1.Caption= Sheets("Sheet1").Range("A1").Value
The form UserForm1 pop up, but nothing happens to the label.

I'll appreciate your help.
 
S

Sam Wilson

Can you put

Me.Label1.Caption = Sheets("Sheet1").Range("A1").Value

In the initialize event for UserForm1?
 
S

Scott

Sam, thanks a lot for you answer. I am not a programmer. I'm confused on
"the initialize event for UserForm1"

What's "the initialize event"? I just use "UserForm1.show" and the form
comes up. You mean I need "the initialize event"? And how to do that?

Many thanks.
 
J

Jacob Skaria

From VBE window; from the left treevew right click the UserForm icon and View
Code. From the code panel 1st drop down select User form and form the second
drop down select Initialize event..1st drop down shows the controls and 2nd
one its events..

If this post helps click Yes
 

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