Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Paste Special problems | Excel Discussion (Misc queries) | |||
Cut and paste problems! | Excel Discussion (Misc queries) | |||
Paste problems | Excel Discussion (Misc queries) | |||
format and paste problems | Excel Discussion (Misc queries) | |||
Copy - Paste problems | Excel Discussion (Misc queries) |