Option box text - linked to cell

J

jday

I have several option boxes that are contained within a group box. I would
like the 'text' that appears within each option box to be linked to a
specific cell. For example if we have option boxes 1 thru 10, I may have a
table containing names in cells A1 thru A10. Option box 1 text would be
linked to cell A1, option box 2 would be linked to A2, etc. This would
allow the option box 'text' to change if the descriptions in the table
change. Is there a simple way to accomplish this?
 
J

Jeff

Depending on where your Option Buttons Are Either of these should do it
'If On a worksheet
Private Sub Workbook_Open()
With Worksheets(1)
.OptionButton1.Caption = Worksheets(1).Range("A1")
.OptionButton2.Caption = Worksheets(1).Range("A2")
.OptionButton3.Caption = Worksheets(1).Range("A3")
End With
End Sub
------------Or----------------
'If on a UserForm
Private Sub UserForm_Initialize()
With UserForm1
.OptionButton1.Caption = Worksheets(1).Range("A1")
.OptionButton2.Caption = Worksheets(1).Range("A2")
.OptionButton3.Caption = Worksheets(1).Range("A3")
End With
End Sub
 
J

jday

Worked perfectly! Thanks for your help.

Jeff said:
Depending on where your Option Buttons Are Either of these should do it
'If On a worksheet
Private Sub Workbook_Open()
With Worksheets(1)
.OptionButton1.Caption = Worksheets(1).Range("A1")
.OptionButton2.Caption = Worksheets(1).Range("A2")
.OptionButton3.Caption = Worksheets(1).Range("A3")
End With
End Sub
------------Or----------------
'If on a UserForm
Private Sub UserForm_Initialize()
With UserForm1
.OptionButton1.Caption = Worksheets(1).Range("A1")
.OptionButton2.Caption = Worksheets(1).Range("A2")
.OptionButton3.Caption = Worksheets(1).Range("A3")
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top