Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste Special problems kristin-101 Excel Discussion (Misc queries) 6 April 17th 09 07:23 PM
Cut and paste problems! cstratton Excel Discussion (Misc queries) 2 December 4th 08 05:59 PM
Paste problems Olga Excel Discussion (Misc queries) 1 February 19th 08 08:14 PM
format and paste problems Natalie Excel Discussion (Misc queries) 2 November 14th 07 02:32 AM
Copy - Paste problems Guillermo Excel Discussion (Misc queries) 0 April 9th 05 04:27 AM


All times are GMT +1. The time now is 12:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"