PDA

View Full Version : Hide rows based on cell in row



ssinghal
07-17-2007, 06:50 AM
I want to hide rows from 7 to 22 only if the value in column M for that row is zero. First Unhide rows 7 - 22, then go and hide those with the o value. I appreciate anyones help. I think this is an easy one.

mdmackillop
07-17-2007, 07:10 AM
Sub Hide722()
Dim cel as range
ActiveSheet.Rows("7:22").Hidden = False
For Each cel In Range("M7:M22")
If Len(cel) = 1 And cel = 0 Then cel.EntireRow.Hidden = True
Next
End Sub

ssinghal
07-17-2007, 10:29 AM
Thanks for your help. You make me look like a genious in the office here.

mdmackillop
07-17-2007, 10:43 AM
Take the praise and don't give the game away!