preserving variable from userform

G

Gary Keramidas

any way to preserve a variable set when an optionbutton is true, a
commandbutton is clicked and the userform hidden? doesn't seem to want to be
available after it's hidden. i know i could store it on a sheet, but didn't want
to do that. even tried a public variable and it didn't work either
 
J

Jim Cone

Hi Gary,
Well this is the answer I was going to give: <g>
As long as the form is not Unloaded then all you need is...
x = UserForm1.OptionButton1.Value

If it is some value you determined while the form was open,
then assign the value to the .Tag property of the OptionButton ...
OptionButton1.Tag = "Mush" or OptionButton1.Tag = CStr(LongVariable)
Then after the form is hidden...
x = CLng(UserForm1.OptionButton1.Tag)
Regards,
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Gary Keramidas"
<GKeramidasATmsn.com> wrote in message
any way to preserve a variable set when an optionbutton is true, a
commandbutton is clicked and the userform hidden? doesn't seem to want to be
available after it's hidden. i know i could store it on a sheet, but didn't want
to do that. even tried a public variable and it didn't work either
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top