David04Ruiz
New Member
- Joined
- Aug 29, 2022
- Messages
- 18
- Office Version
- 365
- Platform
- Windows
Hi all, I am using the following code to select the 2nd row of data (the top row is just column titles) and everything under it:
This code works 99% of the time, however, in cases when there is only one row of data (row 2), it selects row 2 and then highlights the entire sheet because there is no "end" to the data. Is there a way I can avoid this where it selects row 2 and below and/or just row 2 if row 2 happens to be the only data available that day?
VBA Code:
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
This code works 99% of the time, however, in cases when there is only one row of data (row 2), it selects row 2 and then highlights the entire sheet because there is no "end" to the data. Is there a way I can avoid this where it selects row 2 and below and/or just row 2 if row 2 happens to be the only data available that day?