Delete rows if they are empty

S

steve

The easiest way its to record a macro and than edit it for future use.
The steps to take for your code:

1. Select a column.
2. Edit > Go To > Special > Blanks
3. Delete Rows
 
T

Tom Ogilvy

Your attachment is not visible outside the excelforum.

Best to explain your problem in your posting.

Sub DeleteEmptyRows()
Dim rng as Range
Dim cell as Range
Dim rng1 as Range
set rng = Range(cells(1,1),cells(rows.count,1).End(xlup))
for each cell in rng
if application.CountA(cell.EntireRow) = 0 then
if rng1 is nothing then
set rng1 = cell
else
set rng1 = union(rng1,cell)
end if
end if
Next
if not rng1 is nothing then
rng1.EntireRow.Delete
End if
End Sub

Would be my guess
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top