Well, I'm nearly done reading MrExcel On Excel. I'm on page 429 (but I still don't know "who done it." )
I came across a snippet of code (that I extrapolated) to delete rows of data.
Sheets("Consolidation").Range(Sheets("Consolidation").Range("A1"), Sheets("Consolidation").Range("A1").End(xlDown)).EntireRow.Delete
The code works BUT: I noticed that RANGE fully qualifies the reference, including the sheet object. It seemed redundant to me to use the Sheets reference at the beginning of the syntax so I altered the line of code to read:
Range(Sheets("Consolidation").Range("A1"), Sheets("Consolidation").Range("A1").End(xlDown)).EntireRow.Delete
This also works.
My question: Is there a reason why the recommendation was made to include the Sheets at the beginning of the statement?
I came across a snippet of code (that I extrapolated) to delete rows of data.
Sheets("Consolidation").Range(Sheets("Consolidation").Range("A1"), Sheets("Consolidation").Range("A1").End(xlDown)).EntireRow.Delete
The code works BUT: I noticed that RANGE fully qualifies the reference, including the sheet object. It seemed redundant to me to use the Sheets reference at the beginning of the syntax so I altered the line of code to read:
Range(Sheets("Consolidation").Range("A1"), Sheets("Consolidation").Range("A1").End(xlDown)).EntireRow.Delete
This also works.
My question: Is there a reason why the recommendation was made to include the Sheets at the beginning of the statement?