Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think its easier to reference the cells
then the button just reflect the cell values each time you open the WB up. jnf40 wrote: There are 7 optionbuttons, created from the forms tool bar on the worksheet, group 1 contains optionbuttons 1 and 2, if opb1 is clicked then cell F1 would = 1 if opb2 is clicked then F1 would = 2. Group 2 contains optionbuttons 3 and 4, if opb3 is clicked then cell F2 would = 1 if opb4 is clicked then F2 would = 2. Group 3 contains optionbuttons 5, 6, and 7, if opb5 is clicked then cell F3 would = 1 if opb6 is clicked then F3 would = 2, and if opb7 is clicked then F3 would = 3. When wb2 opens I want the values of the optiobuttons in wb1 to be transfered to the optionbuttons in wb2. The optionbuttons are linked to cells by code in module1 as follows. Sub OptionButton1_Click() ActiveSheet.Unprotect Password:="ABC" Range("F1") = 1 ActiveSheet.Protect Password:="ABC", _ DrawingObjects:=True, _ Contents:=True, _ Scenarios:=True, _ UserInterfaceOnly:=True End Sub Sub OptionButton2_Click() ActiveSheet.Unprotect Password:="ABC" Range("F1") = 2 ActiveSheet.Protect Password:="ABC", _ DrawingObjects:=True, _ Contents:=True, _ Scenarios:=True, _ UserInterfaceOnly:=True End Sub and so on for the remainder of the optionbuttons. The optionbuttons are on the worksheet not on a form. I guess I need to know, will it be easier to check the cell values of F1, F2, and F3 and have wb2!F1 = wb1!F1 and so on then check the value of each optionbutton like, If wb1.Shapes("Option Button 1").Value = xlOff Then wb2.Shapes("Option Button 1").Value = xlOff Else Shapes("Option Button 1").Value = xlOn End If If wb1.Shapes("Option Button 2").Value = xlOff Then wb2.Shapes("Option Button 2").Value = xlOff Else Shapes("Option Button 2").Value = xlOn End If if that's the proper way to reference the optionbuttons. I hope I haven't made it more confusing. "stevebriz" wrote: Are the option button values copied as cells values to workbook 2? If they are thenput in the form_initialize of WB2 put in : optionbutton1. value = Wb2.sheet(1).cells( i,j).value not 100% if this is what you are looking for...but if is not ...explain to a little more for us. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
for each optionbutton | Excel Programming | |||
optionbutton | Excel Programming | |||
OptionButton value | Excel Programming | |||
OptionButton | Excel Programming | |||
OptionButton | Excel Programming |