ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling variable from user form (https://www.excelbanter.com/excel-programming/290732-calling-variable-user-form.html)

Geraldon

Calling variable from user form
 
How would i add a variable which is defined in a workbook
from to a label on a userform?

Ron de Bruin

Calling variable from user form
 
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



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Geraldon" wrote in message ...
How would i add a variable which is defined in a workbook
from to a label on a userform?




Chip Pearson

Calling variable from user form
 
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



"Geraldon" wrote in message
...
How would i add a variable which is defined in a workbook
from to a label on a userform?





All times are GMT +1. The time now is 05:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com