Code Screw-up - Hide will not UnHide

Status
Not open for further replies.

yevlar

New Member
Joined
Apr 23, 2005
Messages
41
Okay, I have a worksheet where Column F contains Check Boxes. At the top of the worksheet I have a checkbox that I want to use to hide rows that have the box in Column F checked.

I tried out the following code and applied it to a regular Form checkbox (not Active-X), and it works great to hide the rows, but will not unhide them when unchecked.

I'm assuming I either missed something in the code or am trying to use code that shouldn't be used for this purpose.

Code:
Sub hide()
Dim Rng As Range, cell As Range

Set Rng = Range("F3:F1000")

For Each cell In Rng
    Select Case cell.Value
        Case Is = True
            cell.EntireRow.Hidden = True
        Case Else
            cell.EntireRow.Hidden = False
    End Select
Next cell

End Sub
 
The second set of code is succeeding to hide and unhide the rows, but each time I click the master checkbox I get Error 400.
Is there a line of the code highlighted when the error occurrs? What line is it?

One of the other things I'm doing is conditional formatting so when the checkbox in Column F is True, the entire row switches to a Green background color. Would it be easier to have the Master Checkbox hide all rows that are Green instead of messing with the checkboxes themselves?
Not easier coding using conditional formatting, no. It's just as easy to check the value of the cell(s) in the column and hide them accordingly as you are currently doing.
 
Upvote 0

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Status
Not open for further replies.

Forum statistics

Threads
1,215,064
Messages
6,122,936
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top