dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
1405
share rss forum feed


Rob
In Deo speramus.
Premium
join:2001-08-25
Kendall, FL
kudos:3

[Excel] Macro to Hide Rows

Hi All,

I have this macro that will hide a row where the value in the P column is zero:


Sub HideRows()
Application.ScreenUpdating = False
Sheets("OVERVIEW_ACTIVITY").Select 'Change as required
Range("P4:P390").Select 'Change as required
For Each cell In Selection
If cell = 0# Then
Range(cell.Address).EntireRow.Hidden = True
End If
Next
End Sub


I'm trying to modify it so that the value in the cell must be 0 and not blank. I have blank rows that are headers within the table, so it sees those as zeros and hides them. More rows will be added overtime, so I'd like the macro to just look at the value of the cell and if NOT blank, but it is equal to zero, to hide it.

Any suggestions?

Thanks!

Robert

--
CheckSite.us | YourIP.us | Reverseip.us



Cudni
La Merma - Vigilado
Premium,MVM
join:2003-12-20
Someshire
kudos:13

Add possibly

and not (isblank(cell)
 
Cudni


Rob
In Deo speramus.
Premium
join:2001-08-25
Kendall, FL
kudos:3

Thanks! For some reason that wasn't working, but I tried isEmpty and that worked!