blububble83
New Member
- Joined
- Mar 10, 2005
- Messages
- 11
i have a lot of checkboxes and i wrote a code to link each checkbox to the cell it is on. However, the cell does not show true or false when i click on the checkbox. Can someone look at my code and tell me what's wrong?
Dim l As Single
Dim T As Single
Dim W As Single
Dim H As Single
Dim i As Single
Dim CB As OLEObject
Worksheets("Products").Select
Cells(1, 1).Activate
'Start inserting checkboxes
i = 2
'check for non empty cells in product column then insert checkbox
Do Until Not Cells(i, 2).Value <> ""
l = Cells(i, 1).Left
T = Cells(i, 1).Top
W = Cells(i, 1).Width
H = Cells(i, 1).Height
Set CB = ActiveSheet.OLEObjects.Add("Forms.CheckBox.1", _
Left:=l, Top:=T, Width:=W, Height:=H)
With CB
.Object.Caption = ""
.Object.Alignment = fmAlignmentLeft
.Object.BackColor = &H80000005
.Object.BackStyle = fmBackStyleTransparent
.LinkedCell = Cells(i, 1).Address
.Placement = xlMove
End With
i = i + 1
Loop
Dim l As Single
Dim T As Single
Dim W As Single
Dim H As Single
Dim i As Single
Dim CB As OLEObject
Worksheets("Products").Select
Cells(1, 1).Activate
'Start inserting checkboxes
i = 2
'check for non empty cells in product column then insert checkbox
Do Until Not Cells(i, 2).Value <> ""
l = Cells(i, 1).Left
T = Cells(i, 1).Top
W = Cells(i, 1).Width
H = Cells(i, 1).Height
Set CB = ActiveSheet.OLEObjects.Add("Forms.CheckBox.1", _
Left:=l, Top:=T, Width:=W, Height:=H)
With CB
.Object.Caption = ""
.Object.Alignment = fmAlignmentLeft
.Object.BackColor = &H80000005
.Object.BackStyle = fmBackStyleTransparent
.LinkedCell = Cells(i, 1).Address
.Placement = xlMove
End With
i = i + 1
Loop