Various ways and inconsistencies of deleting cells in sheets

N

no.reply7

I have found inconsistencies in how one deletes all cells in a sheet.

..UsedRange.delete
cells.delete

but once you reset lastrow and lastcolumn, you still find "blank" active cells (not all the time but occasionaly enough that i can screw up you code).

The one which seems to be the most reliable is the following:

cells.EntireRow.Delete
cells.EntireColumn.Delete

I've googled around but have not found any good explanation.

What would a programmer use (I am not a programmer but I am trying to emulate my coding to one)?

Thanks
 
T

thompson759

I have found inconsistencies in how one deletes all cells in a sheet.



.UsedRange.delete

cells.delete



but once you reset lastrow and lastcolumn, you still find "blank" active cells (not all the time but occasionaly enough that i can screw up you code).



The one which seems to be the most reliable is the following:



cells.EntireRow.Delete

cells.EntireColumn.Delete



I've googled around but have not found any good explanation.



What would a programmer use (I am not a programmer but I am trying to emulate my coding to one)?



Thanks

I got this from the Macro Recorder:
Cells.Select
Selection.Delete Shift:=xlUp

M
 
N

no.reply7

Thanks. I was aiming at a cleaner code.

Cells.delete or activehseet.usedrange.delete seems to occasionally fail.
 

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