Deleting Check Boxes Within a Range

H

hovious3

Hello, all.

I was successful in deleting check boxes from a worksheet column by
using:

Sub DeleteCheckboxes()
Dim CBox As CheckBox
Const col As Long = 1 '<<==== (Column A) CHANGE

For Each CBox In ActiveSheet.CheckBoxes
If CBox.TopLeftCell.Column = col Then
CBox.Delete
End If
Next

End Sub

HOWEVER, I would like to delete several columns or a range at one
time. Can someone put me on the right track? Thank you!
 
J

Joel

Sub DeleteCheckboxes()
Dim CBox As CheckBox
Const col As Long = 1 '<<==== (Column A) CHANGE

For Each CBox In ActiveSheet.CheckBoxes
select case CBox.TopLeftCell.Column
Case col1, col2, col3
CBox.Delete

end select
Next

End Sub
 
H

hovious3

Sub DeleteCheckboxes()
Dim CBox As CheckBox
Const col As Long = 1 '<<==== (Column A) CHANGE

For Each CBox In ActiveSheet.CheckBoxes
select case CBox.TopLeftCell.Column
Case col1, col2, col3
CBox.Delete

end select
Next

End Sub

Thanks, Joel.

I am using your code to test some worksheets but can't seem to get
this to work yet. I will play around with it some more.
 
J

Joel

col1, col2, and col3 need to be numbers or defined someplace in the code.
col should be 1 for Col A, 2 for Col B .......
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top