Add a Sheet From a Previous Sheet Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a daily reporting system in which I have a macro to make a new sheet
as well as clear some information from the previous sheet in a workbook with
muliple sheets of different names besides DR(1) etc. Since the number of days
per job is variable, I need to add something into the macro to copy the
previous day information to the new sheet instead of reverting back to the
original to make a copy of it. The macro that I use now is below and you can
see it copys DR(1) when I would like it to copy from DR(6) if that sheet
happens to be in the workbook. I'm not sure what to add in and everthing
tried to date has not worked.

Sub NewDay()

Sheets("DR(1)").Copy After:=Sheets("DR(1)")
Range("U1") = Range("U1") + 1
Range("G12:O31,Q44:V49,H47:H49,K46:K49,N46:N49").Select
Selection.ClearContents
Range("G12").Select
End Sub:

Regards and thanks in advance.
 
How about just working against the activesheet?

So select the sheet to copy first, then run the macro.

Sheets("DR(1)").Copy After:=Sheets("DR(1)")
becomes
Activesheet.Copy After:=activesheet
 
Thanks Dave. It worked like a charm. Why is the answer so obvious after
somebody give it to me!!
 
I guess it's the same reason it's easy to pick last week's lottery numbers!
 

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

Back
Top