Options Button Resetting on File Close

Heronz

New Member
Joined
Feb 13, 2004
Messages
9
I have 45 questions that each has 9 option buttons to select from. Each option button returns a vlaue which is placed into a particular cell in another sheet.

What I want to do is re-set the option buttons to a particular button number on exit - so that each time you open the file it is set in a neutral state ready for the questions to be asked.

i have tried changing the settings in the properties tab for the options buttons but this does not hold after the initial selection is made.

Is there something else that I need to do - or do I need to put a code in the virtual basic part of the sheet to reset certain buttons ??
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hello,
we would need to know more about how your options are grouped, what are the values, etc.
In general, this will set the Optionbutton1 to True when you close your workbook:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Worksheets(1).OptionButton1 = True
End Sub
Martin
 
Upvote 0
Where you have

Worksheets (1) . ....

Do I put inside the brackets the name of the worksheet??
 
Upvote 0
No, index. You can also use:

Sheets(1) for the first sheet or Sheets("Yournamehere") for the name.

Edit,
Worksheets("nameHere") works also, sorry.
 
Upvote 0
RAN INTO TROUBLE

It comes back with an error message -

ambiguous name detected: Workbook_BeforeClose

What does that mean?
 
Upvote 0
It means that you have two procedures with the same name.
In ThisWorkbook class module check that you have just one procedure with this name.
If you need both, combine the code into one.
 
Upvote 0

Forum statistics

Threads
1,214,409
Messages
6,119,339
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top