View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
knowtrump[_19_] knowtrump[_19_] is offline
external usenet poster
 
Posts: 1
Default delete empty rows of a sheet


P. I am probably missing some subtlety in your requirements but th
following
will remove empty rows albeit with a simplistic and work/typin
intensive macro.
Sub Macro2()
'

Dim n As Long, xxxxx As Long
With ActiveSheet

xxxxx = Cells(Rows.Count, "A").End(xlUp).Row
For n = xxxxx To 6 Step -1

If (.Cells(n, "A").Value) = "" And (.Cells(n, "B").Value) = "" An
(.Cells(n, "C").Value) = "" _
And (.Cells(n, "D").Value) = "" And (.Cells(n, "E").Value) = "" Then

.Rows(n).Delete
End If
Next n
End With

End Sub

For your particular requirement the "Ands" have to include A to M. Yo
can use n = 155 to 6 Step -1 rather than xxxxx. If a row is almos
blank but contains say a single not empty cell the row will not b
deleted. I'm sure there are better ways but this should work

--
knowtrum
-----------------------------------------------------------------------
knowtrump's Profile: http://www.excelforum.com/member.php...fo&userid=1966
View this thread: http://www.excelforum.com/showthread.php?threadid=51293