vendredi 2 avril 2021

VBA: for loop skip if cell matches another column

How can i loop trough a column and skip the rows where the cell value matches a list in another sheet?

For Counter = 2 To 5
    rst.AddNew
        rst.Fields("Title") = Sheets("Sheet1").Cells(Counter, 1).Value
        rst.Fields("Names") = Sheets("Sheet1").Cells(Counter, 2).Value
    
    Next Counter

As you can see i have a simple for loop which will loop trough row 2 to 5, but i wanted to check if the value in the cell matches what is in another tab, and if so i wanted to skip that row.

Aucun commentaire:

Enregistrer un commentaire