View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Robert Robert is offline
external usenet poster
 
Posts: 113
Default Hide Rows meeting condition Amendment

Can some one amend the following code to substitute 2 to 10000 to a named range
"CondRange" (for condition range)
--
Dim i%, rng As Range
Set rng = Sheets("Staff").Cells(1, 2)
For i = 2 To 1000
If Sheets("Staff").Cells(i, 2) = "X" Then
Set rng = Union(rng, Sheets("Staff").Cells(i, 2))
End If
Next i
rng.Rows.EntireRow.Hidden = True
End Sub
(original code by Alok Joshi)

Thank you, Robert