
Originally Posted by
bulina2k
Lots and lots of loops you have there. How about a loop-less method:
Hello bulina2k,
Thanks for the code suggestion. I have been looking for code that would accomplish the goal without so many loops.
I ran your code first on my workbook that always runs my posted code very fast and trouble free before trying it on the workbook that has some code slowing issue.
The data in question is from is from columns A-U which can expand to Z or contract to L potentially. Some rows have zeros in all columns while other rows will have from one to a few zeros in random columns.
It occupies to row 359 to start with, changing as rows with "0" are deleted and could potentially go to row 10,000 or ??? to start with
Row 1 is always a header row and must remain in place.
Unfortunately this code has two negative consequences to start with.
1. it deletes the header row or first row each time it is run even when there are no zeros in that rows data.
2. It doesn't seem to move on to column F or further and zeros remain in those columns in random row cells.
In the code I posted if the value for each column was
it would clear the sheet as it saw blank columns to the right of the last populated column as 0.
When I added the quotes around the 0 like
it would not wrongly delete rows with blank cells.
It would appear the code doesn't go to the next column as is needed and it also seems to see blank cells in E1:Z1 as 0 and deletes that row. Changed to E2:Z2 it leaves the header row but deletes row 2 even if no zeros are in the data field.
Bookmarks