Various ways and inconsistencies of deleting cells in sheets

  • Thread starter Thread starter no.reply7
  • Start date Start date
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
 
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
 
Thanks. I was aiming at a cleaner code.

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