I am trying to insert an ActiveX Checkbox into a worksheet. Have finally figured out many things on how to do this, however am stumped on getting the “Linked Cell” to work without a “Run-time error ‘438’: Object doesn’t support this property or method” The code between the asterisks:
“.LinkedCell = LC.Address”
seems to cause the error. I have tried many other versions from websites all over:
'.LinkedCell = Cells(r + 1, 26).Address
'.Placement = xlMove
'.LinkedCell = LC.Offset(0, -8).Address
'.LinkedCell = LC.Address
'.LinkedCell = .TopLeftCell.Offset(0, lCol).Address
'.LinkedCell = Cells(r + 1, 26).Address
'.LinkedCell = ActiveSheet.Range("Z" & (r + 1))
None seem to work.
I would appreciate any help anyone could give me. Would also like to change the name to "Checkbox_" & (r+1), if that is possible, however I get a similar error if I try to use .Name:="Checkbox_" & (r+1)
Current Code is:
Sub Add_Checkbox()
'Works, except to get the linked Cell
Dim oleObj As OLEObject
Dim sh As Worksheet
Dim o As OLEObject
Dim r As Integer
Dim LC As Range
Set LC = Cells(r + 1, 26)
r = 21
Set oleObj = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", _
link:=False, _
DisplayAsIcon:=False, _
Left:=Range("AH" & (r + 1)).Left + Range("AI" & (r + 1)).Width, _
Top:=Range("AH" & (r + 1)).Top + 1, Width:=Range("AH" & (r + 1)).Width - 1, _
Height:=Range("AI" & (r + 1)).Height - 1.5)
With oleObj.Object
.Caption = "Equipment?"
.Font.Size = 6
.BackColor = &H80FF80
'*****************************
.LinkedCell = LC.Address
'*****************************
End With
End Sub
Thanks in advance,
Papa Newch
Bookmarks