User Form option Buttons

rpaulson

Well-known Member
Joined
Oct 4, 2007
Messages
1,428
Code on my user form

Code:
Private Sub CommandButton1_Click()
Select Case True
   Case OptionButton1
      boption = 1
   Case OptionButton2
      boption = 2
   Case OptionButton3
      boption = 3
End Select
Unload FB_Options
End Sub


Code in my module
Code:
...
FB_Options.Show
MsgBox (boption)
...


how do I get the boption value into my vba code so I can use it later?

Thnaks,

Ross
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
?
I tried
Public boption As Integer
but no luck

If there is a better method i'll try it.
 
Upvote 0
This works for me:

<font face=Calibri><SPAN style="color:#00007F">Public</SPAN> boption <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br><br><SPAN style="color:#00007F">Sub</SPAN> foo()<br>    FB_Options.Show<br>    MsgBox (boption)<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0
code in userform
Code:
Call nameofsub(boption)

code in module1
Code:
Private Sub nameofsub(boption)
    msgbox "Value=" & boption
end sub
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,911
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top