Check Box

G

Guest

I currently have two buttons. One that will show the hidden rows, the other
that will hide them again. However, i would rather change the two buttons to
a check box. So if the check box is "Checked" it will show the hidden cells,
but if it is unchecked it will hide the cells again. I assume that is
possible.
 
B

broro183

Hi John,

Here's some code for a check box (originally sourced from Aaron Blood's
highlight.zip file at http://www.xl-logic.com/pages/vba.html):

Private Sub CheckBox1_Click()
If Sheets(1).CheckBox1 Then
'code for hiding rows
else
'code for unhiding rows
End If
End Sub

Nb: depending on your preference/caption in your check box, it may be
better around the other way.

Or another option is just to turn one of your two buttons into a toggle
& delete the other one. Have a look at thread below for ideas to adapt:
http://excelforum.com/showthread.php?t=501643&highlight=toggle+button

hth
Rob Brockett
NZ
Always learning & the best way to learn is to experience...
 

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