Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Click an Optionbutton

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
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
for each optionbutton masterphilch Excel Programming 1 September 21st 05 05:37 PM
optionbutton ZX Excel Programming 1 June 9th 05 12:24 PM
OptionButton value Patrick Simonds Excel Programming 2 January 17th 05 10:50 AM
OptionButton nrage21[_69_] Excel Programming 1 September 29th 04 02:14 AM
OptionButton nrage21[_70_] Excel Programming 0 September 29th 04 12:23 AM


All times are GMT +1. The time now is 06:53 PM.

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"