Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help with copying worksheet (excel 97 vs excel 2000)


Hi

It got the following code

Code:
--------------------
Sub viewtables()
'
Sheets("menu").Range("h3").Value = 1
Sheets("Tables(MAIN)").Copy after:=Sheets(Sheets.Count)
Sheets("Tables(MAIN) (2)").Select
Sheets("Tables(MAIN) (2)").Name = "Tables"
findshapes
Range("d1").Value = ""
Range("A1").Select
Sheets("menu").Range("h3").Value = ""
--------------------


If works perfect on my machine which has excel 2000 however if I go to
a machien with 97 on it comes up with the following error Runtime Error
1004 copy method of worksheet class failed. And breaks at the
"sheets.copy after " part.

Any idea why as I have recorded a macro on excel 97 and it come out
with exactly the same lines.


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=545021

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default help with copying worksheet (excel 97 vs excel 2000)

Hi
Try inserting
Application.CutCopymode = False

before the copy. This clears the clipboard (I think) and I remember it
fixing something similar for me.

regards
Paul

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default help with copying worksheet (excel 97 vs excel 2000)

If you are running your code from an ActiveX CommandButton in XL97, change
its TakeFocusOnClick property from True to False.

Regards,
Peter T

"funkymonkUK"
wrote in message
...

Hi

It got the following code

Code:
--------------------
Sub viewtables()
'
Sheets("menu").Range("h3").Value = 1
Sheets("Tables(MAIN)").Copy after:=Sheets(Sheets.Count)
Sheets("Tables(MAIN) (2)").Select
Sheets("Tables(MAIN) (2)").Name = "Tables"
findshapes
Range("d1").Value = ""
Range("A1").Select
Sheets("menu").Range("h3").Value = ""
--------------------


If works perfect on my machine which has excel 2000 however if I go to
a machien with 97 on it comes up with the following error Runtime Error
1004 copy method of worksheet class failed. And breaks at the
"sheets.copy after " part.

Any idea why as I have recorded a macro on excel 97 and it come out
with exactly the same lines.


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile:

http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=545021



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default help with copying worksheet (excel 97 vs excel 2000)

One other thought - is the workbook protected for structure?

--
Regards,
Tom Ogilvy


"funkymonkUK" wrote:


Hi

It got the following code

Code:
--------------------
Sub viewtables()
'
Sheets("menu").Range("h3").Value = 1
Sheets("Tables(MAIN)").Copy after:=Sheets(Sheets.Count)
Sheets("Tables(MAIN) (2)").Select
Sheets("Tables(MAIN) (2)").Name = "Tables"
findshapes
Range("d1").Value = ""
Range("A1").Select
Sheets("menu").Range("h3").Value = ""
--------------------


If works perfect on my machine which has excel 2000 however if I go to
a machien with 97 on it comes up with the following error Runtime Error
1004 copy method of worksheet class failed. And breaks at the
"sheets.copy after " part.

Any idea why as I have recorded a macro on excel 97 and it come out
with exactly the same lines.


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=545021


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
formatting of charts changes when copying from excel 2000 to 200. philall86 Charts and Charting in Excel 1 June 27th 09 08:33 PM
Excel 2000 problem copying drawingobjects between sheets SiriS Excel Discussion (Misc queries) 0 February 8th 06 10:31 AM
Copying subtotals in Excel 2000 pearsall Excel Discussion (Misc queries) 3 April 21st 05 01:05 PM
Excel 2000 filling/copying Matt Setting up and Configuration of Excel 2 February 1st 05 03:00 PM
Copying an array to a worksheet: Excel 97 vs 2000 Trevor Shuttleworth Excel Programming 1 February 17th 04 03:11 AM


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