Referencing an option button click between worksheets

JustineM

New Member
Joined
Jun 23, 2017
Messages
8
Hi,

I've added some VBA code to update a cell value when an option button is clicked. The option button is part of a group, all events occur on the same worksheet. My code below:
Code:
Private Sub OptionButton1_Click()
Range("A2") = "1"
End Sub

I've repeated this code for all 5 option buttons and it works OK.

On another worksheet, I'd like a cell value to be updated with the contents of a cell, when the option button click is TRUE.

E.g.
Sheet 1
Click Option Button 2
Cell ref A2 changes to show rating 2
On worksheet 2
Cell ref changes to show contents of Sheet 1, cell ref C1

Do I add the event on the sheet where the option button is, if so how? Or, add VBA code on the sheet where I want the text string to be displayed and reference the button click?

Many thanks
JM
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hi JM. Add the option button code to the sheet where the option button is located. Something like this...
Code:
Private Sub OptionButton2_Click()
Sheets("Sheet1").Range("A2") = "2"
Sheets("Sheet2").Range("SomeCell") = Sheets("Sheet1").Range("C1")
End Sub
HTH. Dave
 
Upvote 0
Dave,

This worked as I needed. I was also able to include other actions from the button click.
I was so close in my previous attempts.

Thank you :)
Jm,
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

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