Macro 1 deletes ALL checkboxes on the sheet.
Macro 1 errors out.
How do I delete checkboxes in a given range on the sheet, leaving the others
intact?
Thanks,
Howard
Sub Delete_Checkboxes1()
ActiveSheet.CheckBoxes.Delete
End Sub
Sub Delete_Checkboxes2()
ActiveSheet.Range("A2:B10").CheckBoxes.Delete
End Sub
This is probably more info than you want but...
FWIW:
Not being a fan of putting controls on a sheet *below* the frozen rows, I'd go
a different way...
If your sheet is a form, set the grid up to resemble graph paper so the cells
are square and turn off gridlines. Layout your form using borders for checkbox
cells (I prefer light-weight lines), and set the font to 'Wingdings 2' bold.
Put the following code in the sheet's SelectionCange event...
If Target.Font.Name = "Wingdings 2" Then
Target = IIf(Len(Target) 0, "", "P")
End If
Assuming your form has user instructions for filling it out.., using arrow keys
to move on/off the cell toggles the checkmark. Now all you need to do to remove
checkbox cells is toggle the borders off or hide the row!
FYI:
I use Arial 8 as my default font; -setting column width to 2 for B:AE and row
height to 12 sets up my print area width for using .5 margins for left/right. I
don't like using merged cells when not necessary, but input cells are unlocked
so sheet protection provides navigation flow via the Tab key (or arrow keys).
The cell immediately right of checkbox cells is also unlocked to facilitte the
toggle; -this cell is also left empty for this purpose. Using Shift+Tab returns
to the previous cell; -if it's a checkbox cell the checkmark gets toggled.
More FWIW:
I also use a variation on this approach to expand/collapse options that relate
to the checkbox being selected, and move selection to the 1st option. Grouped
options, in this case, get toggled if any one of the group is selected...
Option with 2 checkbox cells:
chk1 is selected; if user selects chk2 then chk1 is cleared and vice versa.
I find that not using controls below frozen rows makes for a more stable
project when it involves hidden rows. Button cells look/feel/behave like
command buttons as well via formatting.
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion