Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Workbook to Workbook Paste Special

Trying to copy a specific range on a worksheet to another workbook. The
source workbook is not always named the same so need it to be a bit generic
like the code below. The only catch is I need to paste values only and no
formulas.

Sub CopyData()
'need online help to paste special
Dim SourceWB As Workbook
Dim DestinationWB As Workbook
Dim DestinationWS As Worksheet

Set SourceWB = Workbooks.Open("\\Wuslonfs03\share\product\Demand
Planning\DPDatabases\AbyA.xls")
Set DestinationWB = ThisWorkbook
With SourceWB
Set DestinationWS = DestinationWB.Worksheets("Any by Any")
With .Worksheets("Any by Any")
.Range("A1:AC65536").Copy
End With

End With

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 342
Default Workbook to Workbook Paste Special

This is how I would do it:

Sub CopyData()
'need online help to paste special
Dim SourceWB As Workbook
'Dim DestinationWB As Workbook
'Dim DestinationWS As Worksheet

Set SourceWB = Workbooks.Open("\\Wuslonfs03\share\product\Demand
Planning\DPDatabases\AbyA.xls")

'Set DestinationWB = ThisWorkbook
'With SourceWB
' Set DestinationWS = DestinationWB.Worksheets("Any by Any")
' With .Worksheets("Any by Any")
' .Range("A1:AC65536").Copy
' End With
'
'End With

SouceWB.Worksheets("Name of Worksheet to be copied"). _
Range("A1:AC65536").Copy
ThisWorkbook.Worksheets("Any by Any").Range("A1"). _
PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False

End Sub

Note: Sometimes I think that extra variables just get in the way, but I
don't really know your intent so you should use them as you see fit.

Tom
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 values for entire workbook Chris Maddogz Excel Programming 4 May 27th 09 10:10 AM
Copy Paste Special Values Workbook PJFry Excel Programming 2 October 17th 07 06:14 PM
Copy, Paste Special Values all sheets in workbook [email protected] Excel Programming 4 September 27th 07 04:22 PM
Similar to paste special from another workbook [email protected] Excel Worksheet Functions 0 July 9th 07 08:27 AM
How to copy formulas to a new workbook? Paste Special is different MS-Requestor Excel Worksheet Functions 2 May 10th 06 10:19 PM


All times are GMT +1. The time now is 09:23 AM.

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"