checkbox trouble?

mitster

New Member
Joined
Mar 16, 2011
Messages
8
Hey guys, im working on an xls in excel 2003 and having some trouble with checkboxes, i found the following code on the net to add checkboxes via the sheet macro, it works kinda however as i get further down the page the checks arent lining up with the rows, doesnt seem to matter if i start down there either? and the ones i just created (10 in a row starting at row 78) wont delete now by code or by hand!? if i try by code it throws an error at the deleting sub "Runtime error '9' subscript out of range", heres the code i modified:

Code:
Sub AddCheckBox()
Dim cell As Range

DelCheckBox  'Do the delete macro
'or delete all checkboxes in the worksheet
' ActiveSheet.CheckBoxes.Delete

For Each cell In Range("c78:c90")
  With ActiveSheet.CHECKBOXES.Add(cell.Left, _
     cell.Top, cell.Width, cell.Height)
     .LinkedCell = cell.Offset(, 0).Address(External:=True)
     '.Interior.ColorIndex = 1   'or  xlNone or xlAutomatic
     .Caption = ""
     '.Border.Weight = xlThin
  End With
  
Next

End Sub


Sub DelCheckBox()
For Each cell In Range("c78:c90")
Worksheets("Sheet1").CHECKBOXES.Delete
Next
End Sub
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,224,608
Messages
6,179,872
Members
452,949
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top