make Label name on UserForms take on cell value from worksheet


Posted by Artem on April 10, 2001 7:21 PM

for VBA gurus:

Is there a way to make a label on the user form pulling it name (caption) from a worksheet cell?

Same question for the button caption.

Thanks!!!

Posted by Ivan Moala on April 10, 2001 8:00 PM


Try something like;

Private Sub UserForm_Initialize()
Label1.Caption = Sheet1.Range("A1")
CommandButton1.Caption = Sheet1.Range("A2")
End Sub


Ivan

Posted by Dave Hawley on April 10, 2001 8:14 PM

I'm seeing double ?

Just answered a question above the same, so I may as well post mine here too. But Ivans will work!

Dim OptCaption as String
Dim CmdBtnCaption as String

CmdBtnCaption = Sheets("Sheet1").Range("A2")
OptCaption= Sheets("Sheet1").Range("A1")

OptionButton1.Caption= OptCaption
CommandButton1.Caption=CmdBtnCaption

Dave

OzGrid Business Applications

Posted by alfredo sanchez on April 10, 2001 9:11 PM

Re: I'm seeing double ? Sorry I didn't see other post before

Posted by David Hawley on April 10, 2001 9:14 PM

RE: Sorry I didn't see other post before| No prob, the layout does get confusing!

OzGrid Business Applications

Posted by alfredo sanchez on April 10, 2001 9:18 PM

Re: RE: No prob, the layout ....I like to search all the way down for topic, so when I post, messages have changed



Posted by Artem on April 11, 2001 8:09 AM

Thanks guys!

everything works!