A
Angelito Cruz
I am creating multiple groupboxes with corresponding optionbuttons
inside it. I am having issues setting the LinkedCell property for
each radio button. For example, if I have 2 OptionButtons, I set the
LinkedCell of the first OptionButton to the right cell, when I add the second
OptionButton and set it's LinkedCell to the new .Address. The 1st OptionButton
is set to the new .Address.
Here's the code snippet when adding the OptionButton:
Public Sub InsertOptionButton(ByVal Target As Range, strGroupName As String)
Dim optBtn As OptionButton
Set WS = Application.ActiveWorkbook.Worksheets("Notes")
With Target
Set optBtn = WS.OptionButtons.Add _
(Top:=.Top + 4, Left:=.Offset(0, 0).Left + 40, Height:=.Height - 2.5, _
Width:=.Width / 2)
optBtn.Caption = ""
optBtn.Name = "opt" & .Address(0, 0)
optBtn.LinkedCell = .Address
optBtn.GroupBox.Name = strGroupName
End With
End sub
Thanks in advance,
Angelito
inside it. I am having issues setting the LinkedCell property for
each radio button. For example, if I have 2 OptionButtons, I set the
LinkedCell of the first OptionButton to the right cell, when I add the second
OptionButton and set it's LinkedCell to the new .Address. The 1st OptionButton
is set to the new .Address.
Here's the code snippet when adding the OptionButton:
Public Sub InsertOptionButton(ByVal Target As Range, strGroupName As String)
Dim optBtn As OptionButton
Set WS = Application.ActiveWorkbook.Worksheets("Notes")
With Target
Set optBtn = WS.OptionButtons.Add _
(Top:=.Top + 4, Left:=.Offset(0, 0).Left + 40, Height:=.Height - 2.5, _
Width:=.Width / 2)
optBtn.Caption = ""
optBtn.Name = "opt" & .Address(0, 0)
optBtn.LinkedCell = .Address
optBtn.GroupBox.Name = strGroupName
End With
End sub
Thanks in advance,
Angelito