I have just seen a similar Macro for hiding rows...
Can someone help me create a 'CheckBox" Macro that when checked, it hides
the row the checkbox was in?
Mr. Peterson,
Thank you for the help! I really appreciate it.
Can I replace CheckBox1 with CheckBox(Wildcard)? So that all checkboxes in
all rows act the same as the way the Macro does that you provided me with?
Each of those checkboxes from the control toolbox need their own _click event.
But you use something like this to use just one procedure that does all the real
work.
All this stuff goes behind the worksheet with the checkboxes:
Option Explicit
Private Sub CheckBox1_Click()
Call DoTheWork(1)
End Sub
Private Sub CheckBox2_Click()
Call DoTheWork(2)
End Sub
Private Sub CheckBox3_Click()
Call DoTheWork(3)
End Sub
Sub DoTheWork(myIndex As Long)
Dim OLEObj As OLEObject
Set OLEObj = Me.OLEObjects("Checkbox" & myIndex)
With OLEObj
.TopLeftCell.EntireRow.Hidden = .Object.Value
End With
End Sub
=======
One of the nice things about the checkboxes from the Forms toolbar (not the
control toolbox toolbar) is that you can assign the same macro to all of them.
One of the bad things about those Forms toolbar checkboxes is that they don't
play nice with hidden rows. If you look, you'll see that "move and size with
cells" isn't even an option.
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.