Hello -
I have created a functional spreadsheet with a lot of floating option buttons that are grouped in numerous different groups. I have suffered the wrath of the Excel bug that moves objects around when the resolution of the screen changes so I have created a code that moves all of my option buttons back in place upon Open. The problem I found with this was that when the option buttons are moved, they lose their LinkedCell designation, which is necessary to maintain the function of the sheet. So I am trying to write a macro that re-assigns the Linked Cells upon start-up to each option button. I have a list on sheet "ObjPos" with each option button name with the desired LinkedCell location typed as text (ie Sheets!$B$2) two cells over from each entry. I wrote the following code but I can't figure out why the cell won't link. Please help! Thanks
Sub LinkIt()
Dim OptBut As Object
Dim ChkName As String
Dim LinkLocale As Variant
On Error Resume Next
Application.EnableEvents = False
For Each OptBut In Sheets("New Customer Visit Sheet").OptionButtons
ChkName = OptBut.Name
LinkLocale = Application.WorksheetFunction.VLookup(ChkName, _
Worksheets("ObjPos").Range("A2:C46"), 3, False)
With OptBut
.LinkedCell = Range(LinkLocale)
End With
Next OptBut
Application.EnableEvents = True
End Sub
Bookmarks