U
u473
I need to copy the result from Autofilter on Source Workbook A in
Destination Workbook B Sheet1
My VBA AutoFilter Code is in an external Menu Workbook
..
Sub Import()
Dim fso As Object
Dim Source As Object ' Source Folder path
Dim Dest As Object ' Destination Folder Path
Dim WBA as Object ' Source Workbook
Dim WBB as object ' Destination Workbook
Dim LastRow As Long, Dim Rng As Range
'
Set fso = CreateObject("Scripting.FileSystemObject")
Set Source = fso.GetFolder("P:\Invoices")
WBA = "A.xls"
WBB = "B.xls"
Workbooks.Open Filename:=WBA.Path
On Error GoTo 0
LastRow = Range("B65335").End(xlUp).Row: Range("B2").Select
ActiveSheet.Range("$A$2:$W$65535").AutoFilter Field:=2,
Criteria1:="=Open", Operator:=xlOr, Criteria2:="=Re-Submitted"
'
Set Rng = Range("B2").Resize(LastRow - 1)
Workbooks(WBA.Name).Close False
Workbooks.Open Filename:=WBB.Path
'Syntax problem here
Rng.Copy .....
Workbooks(WBB.Name).Close False
End Sub
Help appreciated
J.P.
Destination Workbook B Sheet1
My VBA AutoFilter Code is in an external Menu Workbook
..
Sub Import()
Dim fso As Object
Dim Source As Object ' Source Folder path
Dim Dest As Object ' Destination Folder Path
Dim WBA as Object ' Source Workbook
Dim WBB as object ' Destination Workbook
Dim LastRow As Long, Dim Rng As Range
'
Set fso = CreateObject("Scripting.FileSystemObject")
Set Source = fso.GetFolder("P:\Invoices")
WBA = "A.xls"
WBB = "B.xls"
Workbooks.Open Filename:=WBA.Path
On Error GoTo 0
LastRow = Range("B65335").End(xlUp).Row: Range("B2").Select
ActiveSheet.Range("$A$2:$W$65535").AutoFilter Field:=2,
Criteria1:="=Open", Operator:=xlOr, Criteria2:="=Re-Submitted"
'
Set Rng = Range("B2").Resize(LastRow - 1)
Workbooks(WBA.Name).Close False
Workbooks.Open Filename:=WBB.Path
'Syntax problem here
Rng.Copy .....
Workbooks(WBB.Name).Close False
End Sub
Help appreciated
J.P.