Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variable to and from a form
If I declare a variable as Public in a normal module, then update the
variable in a form module - the update is lost as soon as I exit the form. Any way around it? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing variable to and from a form
Dan,
It will not - if you are not using "End" anywhere, - or resetting your project, by using the <stop icon in the VBE. - And in a standard module, you have Dim YourVar As <SomeDataType Also, are you using Option Explicit in all modules ? <Standard Module code Public MyVar As String <Standard Module code <UserForm code Private Sub UserForm_Click() MyVar = MyVar & "Updated from userform" & vbNewLine End Sub <UserForm code <Worksheet code Private Sub CommandButton1_Click() MsgBox MyVar UserForm1.Show 'Note showing modal MsgBox MyVar 'End End Sub <Worksheet code Test a few times, then uncomment the "End" and test a few more times. NickHK "Dan" wrote in message ... If I declare a variable as Public in a normal module, then update the variable in a form module - the update is lost as soon as I exit the form. Any way around it? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
passing a variable from sheet to form to another sheet | Excel Programming | |||
Passing variable to VarType of other Variable | Excel Programming | |||
passing variable to file... | Excel Programming | |||
passing control value from one form to another form | Excel Programming | |||
Passing variable from one sub to another | Excel Programming |