Share via

Using VBA to Set a Radio Button

Anonymous
2011-08-03T12:54:37+00:00

Hi,

(Following on from an earlier post today).

I have a group of 6 radio buttons on one sheet ("Menu") and five groups of 6 buttons each on another sheet ("Option"). The buttons in the groups in Option are from the Forms menu NOT the Controls Toolbox (I can't get the CT buttons to work the way I need them to).

What I want is for a user to select one of the buttons on teh Menu page and this selection to operate a pre-defined set of buttons across the groups on Option.

I have tried a whole load of variations of the following code (on the Menu sheet), but keep getting the run time 438 "Object doesn't support this property or method" error. Can someone please let me have the correct syntax for what I'm trying to do?

Private Sub OptionButton1_Click()

Application.ScreenUpdating = False

Sheets("Option").Unprotect

Sheets("Option").OptionButton141.Value = True

Sheets("Option").OptionButton105.Value = True

Sheets("Option").OptionButton114.Value = True

Sheets("Option").OptionButton122.Value = True

Sheets("Option").OptionButton130.Value = True

Sheets("Option").Select

Application.ScreenUpdating = True

End Sub

Hope this makes sense!

TIA

Dave

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2011-08-03T13:11:58+00:00

Got it!

I was actually doing things the wrong way round.

So the answer is on record, what I did was change the value of the cell that teh option buttion groups are linked to, which forceds the buttons to "select themselves" as it were:

Private Sub OptionButton1_Click()

Application.ScreenUpdating = False

Sheets("Option").Unprotect

Sheets("Option").Range("k4").Value = 1

Sheets("Option").Range("k6").Value = 1

Sheets("Option").Range("k8").Value = 1

Sheets("Option").Range("k10").Value = 1

Sheets("Option").Range("k12").Value = 1

Sheets("Option").Select

Application.ScreenUpdating = True

End Sub 

'repeated for the other 5 buttons on teh Menu sheet

Dave

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2011-08-10T09:38:50+00:00

    Thanks for the update!

    Was this answer helpful?

    0 comments No comments