Hi,
Hoping someone might be able to put me on track for something to replace the VLOOKUP in the following code. It works, but not if the situation has multiple ‘var1s’ for one entry
[pre]
[/pre]
Thanks in advance.
Hoping someone might be able to put me on track for something to replace the VLOOKUP in the following code. It works, but not if the situation has multiple ‘var1s’ for one entry
[pre]
Code:
Dim numRows As Integer
Dim var1 As Variant
Dim var2 As String
numRows = ActiveCell.CurrentRegion.Rows.Count
For r = 2 To numRows
var3 = Worksheets("Sheet1").Cells(r, 5).Value
var2 = Worksheets("Sheet2").Cells(r, 2).Value
var1 = Application.WorksheetFunction.VLookup(var2, Range("u2r"), 2, False)
If var1 = "One Status" Then
If var3 = "Condition w" Or var3 = "Condition x” Then
Range("A" & r & ":I" & r).ClearContents
End If
ElseIf var1 = "Another Status" Then
If var3 = " Condition y" Or var3 = " Condition z” Then
Range("A" & r & ":I" & r).ClearContents
End If
‘and so forth till next r
Thanks in advance.