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

Anyone have any idea why this won't work? All I am trying to do is copy the
contents on an entire worksheet from one workbook, and paste over the
contents of a sheet called "Data" in another workbook.

Set bk = Workbooks.Open(myFileName)
bk.Worksheets(1).Cells.Copy
ThisWorkbook.Worksheets("Data").Cells.Paste
bk.Close savechanges:=False


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Simple Paste

Paste is not a range method, but a worksheet method.

Set bk = Workbooks.Open(myFileName)
bk.Worksheets(1).Cells.Copy _
ThisWorkbook.Worksheets("Data").Cells
bk.Close savechanges:=False

Should work.

HTH,
Bernie
MS Excel MVP


"Steph" wrote in message ...
Anyone have any idea why this won't work? All I am trying to do is copy the contents on an entire
worksheet from one workbook, and paste over the contents of a sheet called "Data" in another
workbook.

Set bk = Workbooks.Open(myFileName)
bk.Worksheets(1).Cells.Copy
ThisWorkbook.Worksheets("Data").Cells.Paste
bk.Close savechanges:=False



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Simple Paste

You can also use

Set bk = Workbooks.Open(myFileName)
bk.Worksheets(1).Cells.Copy
ThisWorkbook.Worksheets("Data").Cells.PasteSpecial xlPasteAll
bk.Close savechanges:=False

--
Regards,
Tom Ogilvy



"Steph" wrote in message
...
Anyone have any idea why this won't work? All I am trying to do is copy
the contents on an entire worksheet from one workbook, and paste over the
contents of a sheet called "Data" in another workbook.

Set bk = Workbooks.Open(myFileName)
bk.Worksheets(1).Cells.Copy
ThisWorkbook.Worksheets("Data").Cells.Paste
bk.Close savechanges:=False



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
Simple Paste Issue Shai Shefer Excel Programming 3 August 29th 06 10:34 PM
Simple Copy and Paste Michael Excel Programming 1 March 7th 05 09:18 AM
Real simple VBA not sure why I cannot paste. Jason Excel Programming 2 April 7th 04 07:11 PM
Simple Copy & Paste Bob Barnes[_3_] Excel Programming 3 February 20th 04 11:09 PM
Simple copy and paste Fritz[_2_] Excel Programming 2 November 22nd 03 01:56 PM


All times are GMT +1. The time now is 11:13 AM.

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

About Us

"It's about Microsoft Excel"