Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default EXCEL VBA - Run-time Error 1004

run-time error 1004 - Copy method of sheets class failed.

Sheets("All_Reg_Data").Select
Dim i_WHY_AM_I_5 As Integer
i_WHY_AM_I_5 = 5
Range(Cells(1, i_WHY_AM_I_5), Cells(1, i_TotalNumberOfColumns
1)).Select
Selection.Copy
Sheets("Reg_Data").Select
Cells(1, i_WHY_AM_I_5).Select
ActiveSheet.Paste
Sheets(Array("Reg_Data", "Reg")).Select
Sheets("Reg").Activate
Sheets(Array("Reg_Data", "Reg")).Copy

I recieved the error on the final line.

The table consists of 6 sheets.

The Reg_data is a table of Data, the Reg is a graph. Not sure if thi
makes a difference.



Thanks for your hel

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default EXCEL VBA - Run-time Error 1004

Sub ABCD()
Dim i_TotalNumberOfColumns As Integer
i_TotalNumberOfColumns = 10
Sheets("All_Reg_Data").Select
Dim i_WHY_AM_I_5 As Integer
i_WHY_AM_I_5 = 5
Range(Cells(1, i_WHY_AM_I_5), _
Cells(1, i_TotalNumberOfColumns - 1)).Select
Selection.Copy
Sheets("Reg_Data").Select
Cells(1, i_WHY_AM_I_5).Select
ActiveSheet.Paste
Sheets(Array("Reg_Data", "Reg")).Select
Sheets("Reg").Activate
Sheets(Array("Reg_Data", "Reg")).Copy


End Sub

ran fine for me with Reg being a worksheet or Reg being a chartsheet. Is
sheet Reg hidden?

--
Regards,
Tom Ogilvy


"sakieboy " wrote in message
...
run-time error 1004 - Copy method of sheets class failed.

Sheets("All_Reg_Data").Select
Dim i_WHY_AM_I_5 As Integer
i_WHY_AM_I_5 = 5
Range(Cells(1, i_WHY_AM_I_5), Cells(1, i_TotalNumberOfColumns -
1)).Select
Selection.Copy
Sheets("Reg_Data").Select
Cells(1, i_WHY_AM_I_5).Select
ActiveSheet.Paste
Sheets(Array("Reg_Data", "Reg")).Select
Sheets("Reg").Activate
Sheets(Array("Reg_Data", "Reg")).Copy

I recieved the error on the final line.

The table consists of 6 sheets.

The Reg_data is a table of Data, the Reg is a graph. Not sure if this
makes a difference.



Thanks for your help


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default EXCEL VBA - Run-time Error 1004

Hey Tom,

I just ran your code and got the same error....
MS Excel 97, I don't think that it makes a difference...thanks for your
promptness. Not really sure what it's attempting to do, possibly
transport the data from a table to a graph (new code for me). Let me
know if you come up woth any more suggestions.


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default EXCEL VBA - Run-time Error 1004

Hey Tom,



Any explanation to why mine still doesn't work...I tried you
code....and it gives me the same error

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default EXCEL VBA - Run-time Error 1004

Hey Tom


I think I might have solved...would like your input on the solution.

'initial code...
' Sheets(Array(WorkSheet4_Reg_Data, Chart2_Reg)).Copy
'replace with....
Sheets(Array(WorkSheet4_Reg_Data, Chart2_Reg)).Select
Selection.Cop

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default EXCEL VBA - Run-time Error 1004

I started Excel, Personal.xls
Created 2 Sheets, Sheet1 and Sheet2,
Created a macro, and out this in the macro
Sheets(Array("Sheet1", "Sheet2")).Select
Sheets("Sheet1").Activate
Sheets(Array("Sheet1", "Sheet2")).Copy

I ran it and got the same error
run-time error '1004' Copy method of Sheets class failed

I then put a break point on the top line of the Macro and when it hi
the break point I manually selected the 2 Worksheets and placed th
following code in my immediate box and got the same error.

Sheets(Array("Sheet1", "Sheet2")).Copy


Thanks:confused

--
Message posted from http://www.ExcelForum.com

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
Run-Time error '1004' [email protected] Excel Discussion (Misc queries) 3 March 29th 06 08:13 PM
Run Time Error '1004' D Huber Excel Worksheet Functions 1 September 23rd 05 03:52 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
Run-time error '1004' running to excel objects at once Dianna Braden Excel Programming 0 October 16th 03 08:55 PM
HELP!! Excel 2000 Copy of worksheet class failed run time Error 1004 Martin[_6_] Excel Programming 1 August 2nd 03 03:16 PM


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