Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Unable to copy another spreadsheet to the current spreadsheet with

I turned on the macro recorder on the current spreadsheet and called up
another spreadsheet, selected All, and pasted to the current spreadsheet
successfully. When I played back the macro, I got this message:

Select Method of Range Class failed:

The code is listed below and the error occured at Cells.Select:

ChDir "T:\ArchivePandL's"
Workbooks.Open Filename:="T:\ArchivePandL's\PL09-05.xls", UpdateLinks:=0
Selection.Copy
Windows("BchPerAuto1.xls").Activate
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Monthly").Select
Cells.Select
Range("E1").Activate
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default Unable to copy another spreadsheet to the current spreadsheet with

rmcompute:

Add a VBA module to your project and add this code to it.

Set wbk = Workbooks.Open(Filename:="T:\ArchivePandL's\PL09-05.xls",
UpdateLinks:=0)
'PL09-05.xls if copy Sheet1!A1:10
wbk.Sheets("Sheet1").Range("A1:A10").Copy
With ThisWorkbook.Sheets("Monthly").Range("E1")
.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"rmcompute" wrote:

I turned on the macro recorder on the current spreadsheet and called up
another spreadsheet, selected All, and pasted to the current spreadsheet
successfully. When I played back the macro, I got this message:

Select Method of Range Class failed:

The code is listed below and the error occured at Cells.Select:

ChDir "T:\ArchivePandL's"
Workbooks.Open Filename:="T:\ArchivePandL's\PL09-05.xls", UpdateLinks:=0
Selection.Copy
Windows("BchPerAuto1.xls").Activate
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Monthly").Select
Cells.Select
Range("E1").Activate
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Unable to copy another spreadsheet to the current spreadsheet

It worked.

Thank you.

"chijanzen" wrote:

rmcompute:

Add a VBA module to your project and add this code to it.

Set wbk = Workbooks.Open(Filename:="T:\ArchivePandL's\PL09-05.xls",
UpdateLinks:=0)
'PL09-05.xls if copy Sheet1!A1:10
wbk.Sheets("Sheet1").Range("A1:A10").Copy
With ThisWorkbook.Sheets("Monthly").Range("E1")
.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"rmcompute" wrote:

I turned on the macro recorder on the current spreadsheet and called up
another spreadsheet, selected All, and pasted to the current spreadsheet
successfully. When I played back the macro, I got this message:

Select Method of Range Class failed:

The code is listed below and the error occured at Cells.Select:

ChDir "T:\ArchivePandL's"
Workbooks.Open Filename:="T:\ArchivePandL's\PL09-05.xls", UpdateLinks:=0
Selection.Copy
Windows("BchPerAuto1.xls").Activate
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("Monthly").Select
Cells.Select
Range("E1").Activate
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=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
Inserting part of a Spreadsheet into the Current Spreadsheet nytwodees Excel Discussion (Misc queries) 3 April 22nd 09 06:16 PM
Macro to copy and append spreadsheet changes to new spreadsheet Journey Excel Discussion (Misc queries) 1 June 13th 08 04:33 PM
How do I copy spreadsheet data as shown to another spreadsheet? trainer07 Excel Discussion (Misc queries) 2 August 7th 06 09:39 PM
In Excel I want to copy text from spreadsheet to spreadsheet Kris Excel Worksheet Functions 3 June 9th 06 07:58 PM
How to open another Excel spreadsheet to copy data into current spreadsheet ? Ricky Pang Excel Programming 0 July 13th 03 01:59 PM


All times are GMT +1. The time now is 11:21 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"