Copying the active worksheet to another worksheet in the same work

Q

queenmaam

I am recording a simple macro to insert a new worksheet and copy the content
of the active worksheet to it. Using the macro recorder, it works fine the
first time, but if I try to use the same macro to copy the second sheet (the
one just created) to a third sheet, it still copies from the original (first)
sheet. I can see why that happens, but I'm not sure how to rework the macro
to copy from the active sheet rather than from the original sheet.

The goal is to copy information from one week's sheet to create a sheet for
the next week for the duration of a project.
 
B

Betty H

I find that it is simpler to make an exact copy of the existing worksheet.
To do this make the worksheet you want to copy the active worksheet, hold the
Ctrl button down while you click on the active worksheet tab and drag/drop it
next to it. Then release the Ctrl button. This creates an exact duplicate
of the active worksheet.
 
Q

queenmaam

Thanks, Betty. I know I can do it that way, I'm just trying to automate it as
much as I can for others on my team.
 
G

Gord Dibben

I would say that the macro has the original sheet name hard-coded due to the
macro recorder steps.

Change any hard-coded name to Activesheet.

i.e. original code Sheets("Sheet1").cells.copy etc.

Change to ActiveSheet.cells.copy etc.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top