VBA copy active worksheet, rename and paste to end

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
42,669
Office Version
365
Platform
Windows
Just use the code from post#2 & ensure that the latest sheet is the active sheet when you run it.
 

RedOctoberKnight

Board Regular
Joined
Nov 16, 2015
Messages
60
Office Version
2016
Platform
Windows
it works when I only have one sheet but once I select the sheet it just built and run it again, it gives me a same name error.

Sub Sample()
ActiveSheet.Copy , Sheets(Sheets.Count)
ActiveSheet.Name = Format(Range("A1").Value + 7, "dd_mm_yy")

End Sub


When i get the error msg and I hit end, it creates a new sheet but the date is still the same and its just added a (2) or (3) to the name.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
42,669
Office Version
365
Platform
Windows
In that case you have not changed the date in A1, which you said you would be doing.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
42,669
Office Version
365
Platform
Windows
Glad we could help & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,102,350
Messages
5,486,349
Members
407,541
Latest member
Emilybuhman

This Week's Hot Topics

Top