View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
rick rick is offline
external usenet poster
 
Posts: 25
Default Control Cell Link for Option Button based on value in a cell

Sub TestLinks()
If ActiveSheet.Cells(1).Value = "1" Then
ActiveSheet.Shapes("OB No. 1").Select
Selection.LinkedCell = "B1"
Range("A1").Select
ElseIf ActiveSheet.Cells(1).Value = "2" Then
ActiveSheet.Shapes("OB No. 1").Select
Selection.LinkedCell = "B2"
Range("A1").Select
End If
End Sub

Assign this macro to each option button. In my test case,
if I changed the linked cell for one option button (which
I named "OB No. 1"), it changed all of them. For some
reason I had to select the option button object first.
There may be another way to write this by by-passing the
selection process. But this works in the meantime....

Rick

-----Original Message-----
I have two option buttons on a sheet. In cell A1, on the

same sheet,
there is a value which can be either 1 or 2.

Can you help me achieve this? ...

If the value in cell A1 is 1, then the Control Cell Link

for the two
option buttons should become cell B1.

If the value in cell A1 is 2, then the Control Cell Link

for the two
option buttons should become cell B2.


---
Message posted from http://www.ExcelForum.com/

.