I have a two sheets one sheet have a data another sheet have a reference supplier list. I need to vlookup with specific suppliers. First i filter the suppliers. After that i need to perform Vlookup funciton. Please if any once help me on this.
Sub Filter1()
Dim DataRK As Worksheet, Ref As Worksheet
Dim RLastRow As Long, DLastRow As Long, X As Long
Dim DataRng As Range, DataRng1 As Range, First As Range
Dim Match
Application.ScreenUpdating = False
Set DataRK = ThisWorkbook.Worksheets("Open")
Set Ref = ThisWorkbook.Worksheets("Reference")
DLastRow = DataRK.Range("G2:G" & Rows.Count).End(xlDown).Row
RLastRow = Ref.Range("N" & Rows.Count).End(xlDown).Row
Set DataRng = DataRK.Range("A1:T" & DLastRow)
Sheets("Open").AutoFilterMode = False
DataRng.AutoFilter Field:=5, Criteria1:="=*Freight Invoice*", Operator:=xlAnd
Set DataRng1 = Ref.Range("N2:O" & RLastRow&)
For X = ActiveSheet.AutoFilter.Range.Offset(1).SpecialCells(xlCellTypeVisible).Cells(1, 18).Select To DLastRow
***Match = Application.Vlookup(DataRK.Range("G" & X).Value, DataRng1, 1, False)***
Error is here above line are not passed please any one help me out
If Not IsError(Match) Then
DataRK.Range("R" & X).Value =Application.Vlookup(DataRK.Range("G" & X).Value, DataRng1, 1, False)
Else
With DataRK.Range("R" & X)
.Value = "Open"
'.Interior.Color = vbRed
End With
End If
Next X
End Sub