View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
jimmy jimmy is offline
external usenet poster
 
Posts: 59
Default How to write a macro to hide an entire row

Thank you mike for your help.
Jimmy

"Mike H" wrote:

Hi,

Try this

Sub Hide_Me()
Set sht = Sheets("Sheet1") ' Change to suit
lastrow = sht.Cells(Cells.Rows.Count, "C").End(xlUp).Row
For x = lastrow To 1 Step -1
If sht.Cells(x, 3).Value < "" _
And sht.Cells(x, 3).Value = 0 Then
sht.Rows(x).Hidden = True
End If
Next
End Sub

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"jimmy" wrote:

Hello guys,

I would like to write a macro that would hide an entire row if the cells
value in that column is equal to 0.
Someting like this:
A B C
1 20000
2 0 - if c2 = 0 then hide entire row
3 20000


Thank you for your help.

José