![]() |
Problems With Paste
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 |
Problems With Paste
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:= _ Workbooks("Book2.xls").Worksheets("Sheet1").Range( "A1") End With End Sub -- Regards, Tom Ogilvy "James Stephens" wrote in message ... 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 |
All times are GMT +1. The time now is 11:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com