vendredi 21 octobre 2016

Only copy cells if a value doesn't exist in a range - VBA If Statement

I want to use an If statement where if the value of a cell doesn't exist in a range then the If statement is true and the action of copying cells into a different worksheet is carried out. The section of code i'm having trouble with is -

If (Value < Date And CompletedValue = "") And (Cells(Examrow, 1).Value <> SummarySheet.Range(Cells(3, 1), Cells(100, 1)).Value) Then

The code worked fine without the And Cells(Examrow, 1).Value <> SummarySheet.Range(Cells(3, 1), Cells(100, 1)).Value) Then section so i figure this is where i'm going wrong.

It should look at the cell (Examrow, 1), get the value and then compare it to all of the cells in range A3:A:100 in the worksheet SummarySheet. If the value is not already in the range specified, then the if statement should do its thing.

Any Ideas?

Aucun commentaire:

Enregistrer un commentaire