View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Flanagan Bob Flanagan is offline
external usenet poster
 
Posts: 340
Default Deleting blank rows

Try something like this (untested)

For I = 500 to 1 step -1
if isempty(cells(I,1)) then rows(i).delete
Next

It is best to delete from the bottom up.

Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Alan M" wrote in message
...
I am trying to delete a series of rows from a spreadsheet using the
following
code.

Public Sub DeleteRows()

Dim i As Integer


Do Until i = 500

With ActiveCell
If ActiveCell.Value = Nul Then
.EntireRow.Select
Selection.Delete
(Cells(1, 0)).Select

End If


End With
Selection(0).End(xlDown)(2).Select

Loop

End Sub

Once the row has been deleted I do not know how to move the selected cell
down three rows to the next range to be selected. Can anyone help