View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1444_] Rick Rothstein \(MVP - VB\)[_1444_] is offline
external usenet poster
 
Posts: 1
Default Hiding rows only when a condition has been met

Give this code a try...

Sub HideRowIfZeroInG()
Dim R As Range
Dim LastRow As Long
LastRow = Cells(Rows.Count, "G").End(xlUp).Row
If LastRow 2800 Then LastRow = 2800
For Each R In Range("G3:G" & CStr(LastRow))
If R.Value = 0 And R.Value < "" Then R.EntireRow.Hidden = True
Next
End Sub

Rick



"ordnance1" wrote in message
...
I am trying to come up with something that will look at rows 3 through 2800
and hide any row where the value in column g (of the respective row) was
zero.