Macro to Copy Sheets

Anonymous
2025-04-29T16:26:55+00:00

I have a huge workbook where I need to copy numerous worksheets to the position immediately after the one being copied. I have another macro already to set the sheet names, so that is not a problem, but when I recorded the macro I want, it always copies the same worksheet regardless of the worksheet I start on, even with using relative references when recording, and places in the same place as before instead of based on the current worksheet. The code makes it clear why it is working the way it does. How do I get it to do it relative to the current worksheet?


Sub CopyWorksheet()

' CopyWorksheet Macro

Sheets("2046 SP No Development").Select 

Sheets("2046 SP No Development").Copy Before:=Sheets(16) 

End Sub


BTW, this workbook has been around for 25 years, so it is still based on the xls format. I am willing to update the format if necessary, but it will entail a lot of other work as it will break links into AutoCAD.

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
HansV 462.7K Reputation points MVP Volunteer Moderator
2025-04-29T16:57:43+00:00

Sub CopyWorksheet ActiveSheet.Copy After:=ActiveSheet End Sub

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2025-04-29T17:32:43+00:00

    Thank you. I love it when I receive such an straight forward answer!

    Was this answer helpful?

    0 comments No comments