Thread: hide blank rows
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ADG ADG is offline
external usenet poster
 
Posts: 76
Default hide blank rows

Hi Violet

Below is not elegant but I think it should work OK, just change your sheet
name and range

Sub Tester()
Dim rng As Range
Dim x As Long
With Worksheets("Sheet4")
Set rng = Worksheets("Sheet4").Range("b2:b20")

For Each c In rng
x = c.Row
If .Range("A" & x).End(xlToRight).Column = 256 Then
.Range("A" & x).EntireRow.Hidden = True
End If

Next
End With

End Sub
--
Tony Green


"violet" wrote:

i need to hide all those blank row in my whoel worksheet. found this code in
another thread but realise that this hide the row if that column is blank.
however, what i want is to only hide the row if whole row is w/o data and not
particular column w/o data. so hw can i modify this code or is that any
other code to acheive this?

Sub Tester()
On Error Resume Next
Range("A1:o20").Columns(1).SpecialCells(xlBlanks). _
EntireRow.Hidden = True
On Error GoTo 0

End Sub