ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Various ways and inconsistencies of deleting cells in sheets (https://www.excelbanter.com/excel-programming/446693-various-ways-inconsistencies-deleting-cells-sheets.html)

[email protected][_2_]

Various ways and inconsistencies of deleting cells in sheets
 
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

[email protected]

Various ways and inconsistencies of deleting cells in sheets
 
On Thursday, July 26, 2012 9:58:46 PM UTC-4, wrote:
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

[email protected][_2_]

Various ways and inconsistencies of deleting cells in sheets
 
Thanks. I was aiming at a cleaner code.

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


All times are GMT +1. The time now is 05:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com