Hiding rows in a range based on TRUE/FALSE value in each row

M

michaelberrier

Sheet name: "Education"
Reference Range: A1:A100

I need to hide every entire row in that range if the value in that row
is FALSE. The user will have a checkbox linked to the cells in that
range, and if the box is not checked, the value will be FALSE.

In other words, if the value of A16 is FALSE, that row would be hidden,
and so forth.

I've tried to apply many solutions I've found and none seem to do
exactly that

Thanks.
 
B

Bob Phillips

Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

Application.ScreenUpdating = False

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 2 Step -1
.Rows(i).Hidden = .Cells(i, TEST_COLUMN).Value = False
Next i

End With

Application.ScreenUpdating = True

End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 

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