Calling variable from user form

  • Thread starter Thread starter Geraldon
  • Start date Start date
G

Geraldon

How would i add a variable which is defined in a workbook
from to a label on a userform?
 
Hi Geraldon

You can use this event that will run when you open the userform

Private Sub UserForm_Initialize()
Me.Label1.Caption = Sheets("Sheet1").Range("A1").Value
End Sub
 
I'm not exactly sure what you're asking, but you can assign a
variable's contents to a label on a form with code like

Userform1.Label1.Caption = VarName

If you want to assign the value from a cell, use something like

Userform1.Label1.Caption = Worksheets("Sheet1").Range("A1").Text


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top