ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do you create a macros without overwriting the previous one y. (https://www.excelbanter.com/excel-discussion-misc-queries/788-how-do-you-create-macros-without-overwriting-previous-one-y.html)

Gibbie

How do you create a macros without overwriting the previous one y.
 
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.

Don Guillett

maybe have it find the name of the last sheet

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

--
Don Guillett
SalesAid Software

"Gibbie" wrote in message
...
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.




JE McGimpsey

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


In article ,
Gibbie wrote:

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.



All times are GMT +1. The time now is 08:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com