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
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