I have an ugly spreadsheet that I inherited and want to select a range of cells in a table to copy (and send out in an email) based on finding the last row of usable data in the table. The table is fixed:6 columns x 154 rows RANGE(A1:F154). Data is copied and pasted into this fixed range regardless of the number of actual needed rows. Unused cells contain "," & "-" (see Before Paste table below).
Here is the format of the cells prior to paste of data (each character represents a column (R154xC5)):
Before Paste:
A B C D E F
(R1) , - - - - -
(R2) , - - - - -
(R3) , - - - - -
(R4) , - - - - -
ETC...
After Paste:
A B C D E F
(R1) Doe, John 056 123 546 345 999
(R2) Smith, Sarah 000 232 568 968 222
(R3) Jones, David 222 365 768 246 123 <- last entry
(R4) , - - - - -
(R5) , - - - - -
Etc...
In the After Paste table, my last row of data is row 3 (Jones, David...), therefore the needed range is (A1:F3) NOT (A1:F154). This varies depending on the number of records received from hour to hour. I have started to work on a completely new approach in my "spare" time, but in the interim, I need to do this.
I have found some procedures that are close, but not quite. I was thinking MAYBE vlookup. But the logic fails me. I appreciate and value those opinions of others with so much more experience than me. I know there is code to do this, but don't have the experience to figure it out.
Thanks! Jimi
Here is the format of the cells prior to paste of data (each character represents a column (R154xC5)):
Before Paste:
A B C D E F
(R1) , - - - - -
(R2) , - - - - -
(R3) , - - - - -
(R4) , - - - - -
ETC...
After Paste:
A B C D E F
(R1) Doe, John 056 123 546 345 999
(R2) Smith, Sarah 000 232 568 968 222
(R3) Jones, David 222 365 768 246 123 <- last entry
(R4) , - - - - -
(R5) , - - - - -
Etc...
In the After Paste table, my last row of data is row 3 (Jones, David...), therefore the needed range is (A1:F3) NOT (A1:F154). This varies depending on the number of records received from hour to hour. I have started to work on a completely new approach in my "spare" time, but in the interim, I need to do this.
I have found some procedures that are close, but not quite. I was thinking MAYBE vlookup. But the logic fails me. I appreciate and value those opinions of others with so much more experience than me. I know there is code to do this, but don't have the experience to figure it out.
Thanks! Jimi