belle_the_cat
New Member
- Joined
- Jun 23, 2021
- Messages
- 7
- Office Version
- 365
- 2013
- Platform
- Windows
- MacOS
Hi! I wish I were good at VBA, but sadly this is not the case! I apologize in advance.
I'm working on a workbook that imports several csv files to various sheets, index matches the heck out everything, and the outputs some of the data onto a single page where it's easy to read.
I'm looking for a way to copy a row from sheet 3 and add it to sheet 1, if it is not already on sheet 1. So for any row, if both the invoice number (in row D) and the notes (row F) are already on sheet 1, then don't copy that row over. But if only the invoice number matches, copy over that row.
(The notes section is where people put whatever the issue is with the invoice, which is why I want it to require that both of them match for copying - in the event something was wrong the first time, and then there was another issue on the same invoice, I want the new thing to appear on the list.)
I think I need to use a loop. This is my imagining of what I'm looking for:
( where sheet 1 is the visible sheet, and sheet 3 is the one things are being imported to and matched from)
For sheet 3 row 1, check to see if the value in column D1 matches anything in the D column of sheet 1 (regardless of what row it's in)
if no, copy the row over to sheet 1
if yes, check to see if F1 matches the corresponding F column
if both match, do nothing and move on to the next row
if only the column D matches (but not column F), then copy that row over to sheet 1
and then loop through every row.
Hopefully that makes sense!?
I'm working on a workbook that imports several csv files to various sheets, index matches the heck out everything, and the outputs some of the data onto a single page where it's easy to read.
I'm looking for a way to copy a row from sheet 3 and add it to sheet 1, if it is not already on sheet 1. So for any row, if both the invoice number (in row D) and the notes (row F) are already on sheet 1, then don't copy that row over. But if only the invoice number matches, copy over that row.
(The notes section is where people put whatever the issue is with the invoice, which is why I want it to require that both of them match for copying - in the event something was wrong the first time, and then there was another issue on the same invoice, I want the new thing to appear on the list.)
I think I need to use a loop. This is my imagining of what I'm looking for:
( where sheet 1 is the visible sheet, and sheet 3 is the one things are being imported to and matched from)
For sheet 3 row 1, check to see if the value in column D1 matches anything in the D column of sheet 1 (regardless of what row it's in)
if no, copy the row over to sheet 1
if yes, check to see if F1 matches the corresponding F column
if both match, do nothing and move on to the next row
if only the column D matches (but not column F), then copy that row over to sheet 1
and then loop through every row.
Hopefully that makes sense!?