View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AndrewArmstrong AndrewArmstrong is offline
external usenet poster
 
Posts: 24
Default Hide rows of active selection

See if this is what you are looking for, if not let me know what needs
to be changed.
-Andrew


Sub RangeHideRows()

Dim Rng As Range
On Error Resume Next
Application.DisplayAlerts = False

'Have the user select a range to loop through
Set Rng = Application.InputBox(Prompt:="Please select a range
to run macro on.", _
Title:="SPECIFY RANGE", Type:=8)
On Error GoTo 0
Application.DisplayAlerts = True

'If the selection is blank, exit routine
If Rng Is Nothing Then
Exit Sub
Else

'Get the first row
Dim intrownum As Integer
intrownum = Rng.Row

'loop through each row
For Each Row In Rng
If Range("K" & intrownum) = 0 And Range("N" &
intrownum) = 0 Then
Range("a" & intrownum).EntireRow.Hidden = True
End If
'counter for next row
intrownum = intrownum + 1
Next Row

'reset counter
intrownum = 0

End If
End Sub