ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Manipulating Controls on a worksheet (https://www.excelbanter.com/excel-programming/365412-manipulating-controls-worksheet.html)

David Looney[_2_]

Manipulating Controls on a worksheet
 
I have checkboxes on a worksheet from the Forms tool bar. The checkboxes are
in a named range on the sheet.

I want to loop through these checkboxes (the ones in the named range only)
and delete the ones that are checked along with the row that it sits on. I
would also like to do the reverse i.e. delete all of the ones that are not
checked.


I have made a ShapeRange and can loop through them but I can't figure out
how to manipulate them.


Thanks

using excel 2003



Bob Phillips

Manipulating Controls on a worksheet
 
Looping through them is simple

For each cb In ACtivesheet.Checkboxes
Msgbox cb.Name
Next cb

But, controls do not sit in a named range, they are on a separate layer, so
you can't test if they are in that range. You could test the topleftcell
property for being in the range,

Dim cb As CheckBox

For Each cb In ActiveSheet.CheckBoxes
If Not Intersect(Range("rng"), cb.TopLeftCell) Is Nothing Then
MsgBox cb.Name
End If
Next cb


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"David Looney" wrote in message
...
I have checkboxes on a worksheet from the Forms tool bar. The checkboxes

are
in a named range on the sheet.

I want to loop through these checkboxes (the ones in the named range only)
and delete the ones that are checked along with the row that it sits on. I
would also like to do the reverse i.e. delete all of the ones that are not
checked.


I have made a ShapeRange and can loop through them but I can't figure out
how to manipulate them.


Thanks

using excel 2003






All times are GMT +1. The time now is 02:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com