James Snyder
Well-known Member
- Joined
- Jan 11, 2013
- Messages
- 618
The reason I am posting is to find an efficient (read quick) way to copy a pair of cells from one worksheet to another using matching unique values in "A". Essentially, data is coming from two different databases into two spreadsheet reports with one having two cells per record that need overwritten from correct values from the other workbook.
I thought of two nested loops as the slowest way, with one loop using a .Find as second. On a good day, both sheets will have the same number of rows and there will be no special handling, but there are data entry reasons why a value may come from one database but not the other. Due to this, my first step needs to be a check for duplicate exceptions to verify that the sets match.
If I write the exceptions off to an error handling array and delete them, I should be able to sort both and use a single loop with a direct copy of cells from one workbook to the other. I have seen some amazing code and ideas here and am wondering if anyone has a better idea?
I thought of two nested loops as the slowest way, with one loop using a .Find as second. On a good day, both sheets will have the same number of rows and there will be no special handling, but there are data entry reasons why a value may come from one database but not the other. Due to this, my first step needs to be a check for duplicate exceptions to verify that the sets match.
If I write the exceptions off to an error handling array and delete them, I should be able to sort both and use a single loop with a direct copy of cells from one workbook to the other. I have seen some amazing code and ideas here and am wondering if anyone has a better idea?