G
Guest
I found some code on here that will work for the most part, but I ahve a question about how to output to another workbook.
Here is the code, posted by Rob van Gelder
Rob Writes:
This code will probably do what you're after, assuming row 1 is your header
row.
Sub testit()
Dim lngLastRow As Long
With Sheet1
lngLastRow = .Cells(Rows.Count, 1).End(xlUp).Row
.Columns("A:F").AutoFilter Field:=6, Criteria1:="Brand"
.Range(.Rows(2), .Rows(lngLastRow)).SpecialCells(xlCellTypeVisible).Copy Destination:= _
.Rows(lngLastRow + 1)
End With
End Sub
I try this and it pastes the copied data to the same sheet. I need to paste it to another workbook altogether. Any advice on how to do that would be appreciated. I am guessing I have to do something about "destination", but have I have no idea about the syntax to do that. And I have no header row, if that can somehow be fixed, otherwise I can always input one.
Thanks,
Jim
Here is the code, posted by Rob van Gelder
Rob Writes:
This code will probably do what you're after, assuming row 1 is your header
row.
Sub testit()
Dim lngLastRow As Long
With Sheet1
lngLastRow = .Cells(Rows.Count, 1).End(xlUp).Row
.Columns("A:F").AutoFilter Field:=6, Criteria1:="Brand"
.Range(.Rows(2), .Rows(lngLastRow)).SpecialCells(xlCellTypeVisible).Copy Destination:= _
.Rows(lngLastRow + 1)
End With
End Sub
I try this and it pastes the copied data to the same sheet. I need to paste it to another workbook altogether. Any advice on how to do that would be appreciated. I am guessing I have to do something about "destination", but have I have no idea about the syntax to do that. And I have no header row, if that can somehow be fixed, otherwise I can always input one.
Thanks,
Jim