Conditionally Hide Rows

  • Thread starter Thread starter Mos.StaLL
  • Start date Start date
M

Mos.StaLL

HI All,

How do I conditionally rows if a certain cell = 0? For example, if
any cell within range BA5:BA37 =0 then hide row. Any help will be
appreciated. Thanks.

James
 
How about just selecting that column and doing data|Filter|autofilter.

Then you can show cells not equal to 0.
 
How about just selecting that column and doing data|Filter|autofilter.

Then you can show cells not equal to 0.

Thanks for the help, but I've tried that and it does not refresh when
I import new data. I'm looking for something that updates when I
import new data. Thanks for you help so far.
 
If you are importing your data with MSQuery, then do it with a macro and
include the Filtering feature Dave described.

Vaya con Dios,
Chuck, CABGx3
 
You could use a macro with a Worksheet_Change event like the following:

Private Sub Worksheet_Change(ByVal Target As Range)
Const MyRng = "BA5:BA37"
Dim c As Range
For Each c In Range(MyRng)
If c.Address = Target.Address Then
If Target.Value = 0 Then
Target.EntireRow.Hidden = True
Else
Target.EntireRow.Hidden = False
End If
End If
Next c
End Sub

Right-click on the tab of the sheet where you want to use this, then select
"View code". Paste the function into the worksheet code module when the VB
Editor appears.

Hope this helps,

Hutch
 
Worksheet. A "Worksheet_SelectionChange" subroutine may appear by default
with no code. Ignore it and paste the code I sent in the same module below it.

Hutch
 

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

Back
Top