Copy & rename a sheet appending 01,02,03 ..etc
Sub CopyRen()
Dim shtName As String
Dim intLast As Integer
intLast = ActiveWorkbook.Sheets.Count
shtName = Sheets(1).Name
ActiveSheet.Copy after:=Sheets(intLast)
ActiveSheet.Name = shtName & Format(intLast, "00")
Sheets(shtName).Activate
End Sub
That should do it
"JC" wrote:
I would like a macro to copy the current sheet with appending 01, 02 etc
after it and so on.
Example:
If the current Worksheet was called "WeekA" if I ran the macro 4 times I
would result the following worksheets.
WeekA (current)
WeekA01
WeekA02
WeekA03
WeekA04
If I then exited the Document and opened it again and ran the macro on
"WeekA" worksheet again it would create "WeekA05"
Not a VBA man - only got this far:-
Sub CopyRen()
Dim shtName As String
shtName = ActiveSheet.Name
ActiveSheet.Copy after:=ActiveSheet
ActiveSheet.Name = shtName & "01"
Sheets(shtName).Activate
End Sub
Thanks
John
|