Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default preserving variable from userform

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

--


Gary



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default preserving variable from userform

seems to be working now and i didn't change anything.

--


Gary


"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

--


Gary





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default preserving variable from userform

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

--


Gary



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default preserving variable from userform

thanks jim

--


Gary


"Jim Cone" wrote in message
...
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

--


Gary





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform and variable Jeff Excel Discussion (Misc queries) 1 March 16th 07 03:14 PM
VBA Variable as userform [email protected] Excel Programming 3 April 13th 06 08:32 PM
Variable ComboBox on Userform DHallam Excel Programming 2 July 19th 05 12:20 PM
userform variable as global crew3407[_6_] Excel Programming 8 May 6th 04 04:38 PM
Passing a value to a variable from Userform Neal Steiner Excel Programming 1 July 18th 03 09:12 PM


All times are GMT +1. The time now is 06:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"