Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I declare a Variable as Public (to preserve its value throughout code
execution) eg:- Public MyText As Variant (this is done in a Standard Module) Then in a UserForm I have:- "Private Sub CommandButton1_Click() MyText = TextBox1 (The Locals Window correctly shows MyText has whatever I put in TextBox1) Do some other things Unload UserForm3 End Sub" When the UserForm is unloaded and execution returns to a Standard module I need to use the value in MyText - but in the Locals Window I see that MyText=0. I expected the value in MyText to be retained even though the UserForm where it was created has been unloaded. What am I doing wrong? -- donwb |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Set Public Variable on Open | Excel Discussion (Misc queries) | |||
Public variable | New Users to Excel | |||
How to declare variable as public. | Excel Programming | |||
Public Variable | Excel Programming | |||
public variable | Excel Programming |