Copy method of worksheet class failed (Run-time Error 1004)
Amazing chart utilities from Jon Peltier
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Copy method of worksheet class failed (Run-time Error 1004)

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Hello All,

    I am trying to create a copy of an Excel worksheet using the copy method in Visual Basic and am getting the following error message:

    "Run-time error 1004:
    Copy method of worksheet class failed"

    I have reduced my code to something as simple as the following just to debug this problem.
    ---
    Private Sub CommandButton1_Click()

    Worksheets("Sheet1").Copy after:=Worksheets(Worksheets.Count)

    End Sub
    ---
    This code works perfectly well on my machine at home running Excel 98, but gives the above err mesg on my machine at work running Excel '97.

    How do I fix this?

    I'd really appreciate your help.
    Thanks!

    Manish

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Hi
    These are both shots in the dark...
    Better than no shot at all?
    Anyway, try these two things first.
    For your command button set the "take focus on click" property to false.
    Also, place this line of code before your copy method.
    Range("A1").Activate
    Doubt it will help but who knows...
    Tom

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com