Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code for OptionBox
Hello,
I have a sheet where people can choose between two options. I make use of the OptionButton in the VBA Editor. What I want is that when Option 1 is chosen, the worksheet fills in the value from A1 in to B1. When Option 2 is chosen, the value from A2 should be filled in in to B1. How can I achieve this? Kind regards, Noepie |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code for OptionBox
Assuming you are using the option buttons from the Controls command
bar not the Forms command bar, you can use code like the following: Private Sub OptionButton1_Click() Range("A1").Value = Range("B1").Value End Sub Private Sub OptionButton2_Click() Range("A2").Value = Range("B1").Value End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Fri, 12 Dec 2008 00:20:00 -0800, Noepie wrote: Hello, I have a sheet where people can choose between two options. I make use of the OptionButton in the VBA Editor. What I want is that when Option 1 is chosen, the worksheet fills in the value from A1 in to B1. When Option 2 is chosen, the value from A2 should be filled in in to B1. How can I achieve this? Kind regards, Noepie |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code for OptionBox
Thanx Chip!
"Chip Pearson" wrote: Assuming you are using the option buttons from the Controls command bar not the Forms command bar, you can use code like the following: Private Sub OptionButton1_Click() Range("A1").Value = Range("B1").Value End Sub Private Sub OptionButton2_Click() Range("A2").Value = Range("B1").Value End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Fri, 12 Dec 2008 00:20:00 -0800, Noepie wrote: Hello, I have a sheet where people can choose between two options. I make use of the OptionButton in the VBA Editor. What I want is that when Option 1 is chosen, the worksheet fills in the value from A1 in to B1. When Option 2 is chosen, the value from A2 should be filled in in to B1. How can I achieve this? Kind regards, Noepie |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Equivalent of Access OptionBox | Excel Programming | |||
Excel Checkboxs, Optionbox | Excel Discussion (Misc queries) | |||
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... | Excel Programming | |||
optionbox checkbox | Excel Discussion (Misc queries) | |||
OptionBox error checking | Excel Programming |