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
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