Filter excel data based on another workbook range (1 Viewer)

suryu

Member
Local time
Today, 22:23
Joined
Apr 3, 2020
Messages
78
Hi

I have two workbook and i want to filter one column range only if that value present in another workbook

1)Please find below screenshot, it is present in workbook investor_Code

1590990654211.png

1)On the basis of above investor code i want to filter below workbook data which is Loan_Details
1590990735257.png
 

suryu

Member
Local time
Today, 22:23
Joined
Apr 3, 2020
Messages
78
I did below code but facing error


Sub Investor_Code()

Dim wsDest As Worksheet
Dim ws As Worksheet
Dim LrowData As Long
Dim Autofiltng As Range
Dim Rng As Range



'Destination

Set ws = ThisWorkbook.Sheets("sheet1")

Set wsDest = Workbooks("Investor_code.xlsx").Worksheets("Sheet1")
wsDest.Activate

ActiveSheet.Range("B:B").RemoveDuplicates 1, xlYes
LrowData = Range("A").End(xlDown).Row

ActiveSheet.Range("$A$2:$C$" & LrowData).AutoFilter Field:=2, criteria:="<>"

With ActiveSheet.AutoFilter.Range
On Error Resume Next

Set Autofiltng = .Offset(1, 0).Resize(.Rows.Count - 1, 1).SpecialCells(xlCellTypeVisible)
On Error GoTo 0


End With

ws.Activate
Set Rng = ActiveSheet.AutoFilter.Range
Rng.Offset(1, 0).Resize(Rng.Rows.Count - 1).Copy Destination: ws.Range ("D")


ActiveSheet.ShowAllData



End Sub
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom