Hiding rows with VBA ??


Posted by Tom Urtis on February 23, 2001 2:26 AM

In Excel 97, I maintain data that always potentially occupies the range A5:R100. The quantity and sequence of rows 5:100 that actually contain data changes from week to week, so I would like to write some code that could look at that range and hide any blank rows. I'd imagine that the code would have to start by first unhiding all the rows in this range that were hidden from last week, and then hide the blank rows this week. Beyond that I'm not sure. Any suggestions?



Posted by Dave Hawley on February 23, 2001 4:49 AM


Hi Tom

This will work on the Active sheet.

Sub TryThis()
On Error Resume Next
With Range("A5:R100")
.EntireRow.Hidden = False
.SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True
End With
End Sub


Dave


OzGrid Business Applications