I'm trying to use the following code to add a checkbox at runtime to each data row in my spreadsheet. (Creating them beforehand and just hiding them is not a good option in this case). I can't figure out how to name the checkboxes as I create them, and I don't know how to set the "TopIndex" value to correspond to row "MyRow".
Dim MyRow as Integer
Dim TopIndex
Dim myBox as Object
For MyRow = 5 To LastRow
TopIndex = Rows(MyRow).SomeProperty?
Set myBox = ActiveSheet.OLEObjects.Add _
(ClassType:="Forms.CheckBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=3.75, _
Top:=TopIndex, Width:=21.75, Height:= 10.5)
myBox.Name = "SelectRow" & MyRow
Next MyRow
Thanks in advance for any help you can offer!
VBAjedi![[swords] [swords] [swords]](/data/assets/smilies/swords.gif)
Dim MyRow as Integer
Dim TopIndex
Dim myBox as Object
For MyRow = 5 To LastRow
TopIndex = Rows(MyRow).SomeProperty?
Set myBox = ActiveSheet.OLEObjects.Add _
(ClassType:="Forms.CheckBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=3.75, _
Top:=TopIndex, Width:=21.75, Height:= 10.5)
myBox.Name = "SelectRow" & MyRow
Next MyRow
Thanks in advance for any help you can offer!
VBAjedi
![[swords] [swords] [swords]](/data/assets/smilies/swords.gif)