![]() |
Option box text - linked to cell
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? |
Option box text - linked to cell
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 "jday" wrote: 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? |
Option box text - linked to cell
Worked perfectly! Thanks for your help.
"Jeff" wrote: 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 "jday" wrote: 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? |
All times are GMT +1. The time now is 01:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com