How do you create a macros without overwriting the previous one y.

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

Guest

The worksheet that I have has several tabs along the bottom;
Report/Report2/Report3 etc…/Deliveries/Credits/Weekly Inventory/Recap What I
am trying to do is create a macro that makes a new Report tab daily, I have
done the Macro that creates the daily new report tab but the macro I have
created always copies the original tab. I would like to find out a way that
this macro will always create a copy of the latest report tab.
 
maybe have it find the name of the last sheet

Sub lastsheetname()
ls = Sheets(Worksheets.Count).Name
MsgBox ls
End Sub
 
One way:

Public Sub try98790890()
Dim i As Long
With Worksheets
For i = 1 To .Count
If Not LCase(.Item(i).Name) Like "report*" Then Exit For
Next i
.Item(i - 1).Copy after:=.Item(i - 1)
End With
End Sub
 

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