View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_3_] Bob Phillips[_3_] is offline
external usenet poster
 
Posts: 2,420
Default MACRO TO HIDE BLANK ROWS

Sub DeleteBlanks()
Dim rng As Range
Dim LastRow As Long

Columns("D").Insert
Range("D1").Value = "Flag"
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
Range("D2").Resize(LastRow - 1).Formula = "=C2="""""
Columns("D").AutoFilter field:=1, Criteria1:="=TRUE"
On Error Resume Next
Set rng = Range("D2").Resize(LastRow -
1).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete
Columns("D").Delete
End Sub


--
__________________________________
HTH

Bob

"keyson2004" wrote in message
...
I have developed a model that has 190 lines but certain cells are blank ie
(-) and i would like to hide that row were a certain cell is blank. How do
I
write code for the macro to start at say C1 and then move down to C2 etc
and
then when it finds a cell that is blank ( but contains a lookup formula)
it
will hide that row and then continue until say come to c192 which contains
the word END. Can anybody help me please.