You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
I have a workbook with 2 sheets. The sheet tab is hidden.
Each sheet has an identical set of OptionButtons (4 optionsbuttons, 2 per sheet).
What i want to be able to do:
jump forth and back between sheets via Optionbuttons.
Sheet1: optionbutton1(sheet1)checked. OptionButton2(sheet2)
move to sheet2
Sheet2.optionbutton1(sheet1). OptionButton2(sheet2)checked. set optionbutton1 in sheet1 to checked
Click OptionButton1 in sheet2
move back to sheet1. set optionbutton2 in sheet2 to checked
Thanks for your help, but it doesn't seem to work.Does it work for you?
I can follow your idea, but i get a " Run-time error'438' Objekt doesn't support this property or method".
Worksheets("Sheet2").OptionButton1.Value = False is marked
You wondered what it's all about. I am building a program for the very novice excel user (more than i am). I want a clean user interface with almost everything hidden. I could use a commandbutton for the purpose, but now i have set my mind for optionbuttons!
Let me clarify:
1) Create a workbook that has sheet1 and sheet2 for two of the tab names.
2) Create two option buttons on each sheet and make sure that they are named OptionButton1 and OptionButton2 on both of them
3) In design mode double click OptionButton2 from sheet1 and insert the code for OptionButton2, N0 code for OPTIONBUTTON1 on sheet1
4) In design mode double click OptionButton1 from sheet2 and insert the code for OptionButton1, N0 code for OPTIONBUTTON2 on sheet2
Private Sub OptionButton2_Click()
Not aware of any differences between the two versions myself. May want to check security level (Tools > Macro > Security). Set it to medium and it will prompt you to verify use of macros. Wouldn't suggest low priority to anyone.
Another possible problem is that you might have set the buttons on both pages to to have the same GroupName. Make sure the GroupName property for the option buttons on page 1 is different from the GroupName property of the buttons on page 2.
I finally found out what i was doing wrong.
I made an embarrassing newbies fault. I was using Optionbuttons from the formulas toolbox, instead of optionbuttons from the control element tool box. Now everything works fine.
Once again, thanks for your patience.