I have these codes
But kept getting that error for VLookup. How do I fix the problem?
Code:
If Application.WorksheetFunction.VLookup(Cells(i, "AI").Value & Cells(i, "AH").Value, Sheets("WS rules").Range("D75:E284"), 2, 0) = "Y" Then
If Cells(i, "O").Value = "2" Or Cells(i, "O").Value = "3" Or Cells(i, "O").Value = "4" Or Cells(i, "O").Value = "5" Or Cells(i, "O").Value = "R" Then
Cells(i, "AT").Value = "Y"
Else
If Cells(i, "AS").Value < Application.WorksheetFunction.VLookup(Cells(i, "AG").Value & Left(Cells(i, "B").Value, 1), Sheets("WS rules").Range("F5:I64"), 3, 0) Then
Cells(i, "AT").Value = "Y"
Else
Cells(i, "AT").Value = "N"
End If
End If
If Application.WorksheetFunction.VLookup(Cells(i, "AI").Value & Cells(i, "AH").Value, Sheets("WS rules").Range("D75:E284"), 2, 0) = "Y" And Cells(i, "O").Value = "5" Then
Cells(i, "AY").Value = "Y"
Else
If Cells(i, "AX").Value < Application.WorksheetFunction.VLookup(Cells(i, "AG").Value & Left(Cells(i, "B").Value, 1), Sheets("WS rules").Range("F5:I64"), 4, 0) Then
Cells(i, "AY").Value = "Y"
Else
Cells(i, "AY").Value = "N"
End If
End If
Else
Cells(i, "AT").Value = "N"
End If
Code:
If Application.WorksheetFunction.VLookup(Cells(i, "AG").Value & Left(Cells(i, "B"), 1), Sheets("WS rules").Range("F5:J64"), 5, False) = "Y" Then
Cells(i, "AZ").Value = Cells(i, "AY").Value
Else
Cells(i, "AZ").Value = Cells(i, "AT").Value
End If
But kept getting that error for VLookup. How do I fix the problem?