VBA Filter in External Workbook

dannyok90

Board Regular
Joined
Aug 30, 2016
Messages
115
Hi all,

Im trying to use the following code to open a workbook filter sheet 2 by
column b with "5124" and
column C with "Job numer:" "Parent Job:" "Project Director:" "Client:" "Totals for Job"
Then paste the result in the original active workbook.
I havent got as far as the copying and pasting yet but i guess that will be relatively straight forward?
Any help is greatly appreciated :)
Thanks Dan
Code:
Sub tests()
Dim wbk As Workbook
Set wbk = Workbooks.Open("T:\V-Task\V0000+\200+\V0297\Shared\report.xlsx")
'manipulate the data in the workbook anyway you want, e.g. '
'Variables Declacaration
    Dim Criteria_Val(100) As String
    Dim iRow As Integer
 
    'Loop Thru the List and Create Filter Criteria Array
    iRow = 0
    While Sheets(2).Cells(iRow + 1, 1) <> ""
        Criteria_Val(iRow) = Sheets(2).Cells(iRow + 1, 1)
        iRow = iRow + 1
    Wend
 
    'Multiple Criteria List is Created. Pass it as parameter to Filter
    Sheets(2).Range("B1:B1000000").AutoFilter Field:=1, Criteria1:=Criteria_Val, Operator:=xlFilterValues

'copying and pasting code
Call wbk.Close(False)
End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,216,231
Messages
6,129,631
Members
449,522
Latest member
natalia188

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top