Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with a option buttons located in a userform
Hi everyone I have two option buttons in user form1 I'm wondering what code I would need to use and where it would go to link the that I have placed in to userform 1 to cell "A1" in worksheet 'Material takeoff' this is my first time with userforms and the properties and I'm just a newbie at VBA If option buttion 1 in the user form is selected then cell "A1" should = 1 If option buttion 2 in the user form is selected then cell "A1" should = 2 if neither are selected it should = 0 or blank also the value in cell A1 to change before the userform is closed Thanks in advance for any help -- mav93 ------------------------------------------------------------------------ mav93's Profile: http://www.excelforum.com/member.php...o&userid=31592 View this thread: http://www.excelforum.com/showthread...hreadid=517867 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with a option buttons located in a userform
Put this code in your userform (right click on Userform==view code and
copy/paste) A1 (on Sheet2 in the example .. change to suit your needs ...) is set 0 when the form is loaded. Optionbutton is TRUE when selected which is numerically -1: hence muliples of -1 and -2 to get 1 & 2 in A1 HTH Private Sub OptionButton1_Click() Worksheets("Sheet2").Range("A1") = OptionButton1.Value * -1 End Sub Private Sub OptionButton2_Click() Worksheets("Sheet2").Range("A1") = OptionButton2.Value * -2 End Sub Private Sub UserForm_Initialize() Worksheets("Sheet2").Range("A1") = 0 '<=== set A1 to zero End Sub "mav93" wrote: Hi everyone I have two option buttons in user form1 I'm wondering what code I would need to use and where it would go to link the that I have placed in to userform 1 to cell "A1" in worksheet 'Material takeoff' this is my first time with userforms and the properties and I'm just a newbie at VBA If option buttion 1 in the user form is selected then cell "A1" should = 1 If option buttion 2 in the user form is selected then cell "A1" should = 2 if neither are selected it should = 0 or blank also the value in cell A1 to change before the userform is closed Thanks in advance for any help -- mav93 ------------------------------------------------------------------------ mav93's Profile: http://www.excelforum.com/member.php...o&userid=31592 View this thread: http://www.excelforum.com/showthread...hreadid=517867 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing text size in option buttons on a userform | Excel Programming | |||
Navigating between option buttons is not selecting the option | Excel Programming | |||
SIMPLE UserForm w/ 2 OPTION BUTTONS | Excel Programming | |||
SIMPLE UserForm w/ 2 OPTION BUTTONS | Excel Programming | |||
SIMPLE UserForm w/ 2 OPTION BUTTONS | Excel Programming |