MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Deleting of rows


Posted by Ken Aldag on August 16, 2001 8:12 AM

I have a large spread sheet that has data in all the columns but many rows only have data in column E. If the row only has data in column E I would like to delete the row. HELP

Ken


Posted by neo on August 16, 2001 8:33 AM

ken,

you can try this, but i'll warn you it will take some time... maybe someone can come up with something faster, but :

Private Sub RemoveRows()
dim lastrow as integer
lastrow = 5000 'set this number to the last row in your worksheet...

range("d1").select
do until activecell.row > lastrow
if activecell.value = empty then
activecell.entirerow.delete
else
activecell.offset(1,0).activate
end if
loop

end sub

see if that works; i haven't had a chance to test it...

neo