Conditional Hide rows with zero

V

Vlookup help

Hi,

I would like a VBA code that will allow me to hide certain rows. That is,
if cell A3 has a "1" in it, then I want that entire row (only on this
worksheet, not throughout the workbook) to be hidden. I would also like it
to hide all of the totally blank rows at the bottom of the worksheet. The
last request is that this is a constantly running and as each cell in column
A changes to a "1" then the row is hidden.

Thanks,

Jon
 
G

Gord Dibben

Jon

Worksheet event code........

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value = 1 Then
Excel.Range("A" & n).EntireRow.Hidden = True
End If
End If
enditall:
Application.EnableEvents = True
End Sub

Gord Dibben Excel MVP
 
K

kdreyer

This is what I use:

For I = 1 To 800
Range("A" & I).Select
If ActiveCell.Value = "0" Then
Selection.EntireRow.Hidden = True
Else
End If

Next I
 

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