Hello people,
I am trying to duplicate sheet every time a user click on a button and it will be rename into a sequence.
For example i have sheets ABC, DEF, GHI and the master to duplicate from is 99.
Hence the sheet count is 4. When it is being copied from 99, i want the duplicated sheet to rename 01, 02 and so on. Or 1, 2, and so on.
I found some online but i could not customise to what i need.
Any idea?
I am trying to duplicate sheet every time a user click on a button and it will be rename into a sequence.
For example i have sheets ABC, DEF, GHI and the master to duplicate from is 99.
Hence the sheet count is 4. When it is being copied from 99, i want the duplicated sheet to rename 01, 02 and so on. Or 1, 2, and so on.
I found some online but i could not customise to what i need.
Any idea?
Code:
Sub A_001()
'Duplicate Sheet from master
Dim shtname As String
Set WS = Sheets("99")
WS.Copy After:=Sheets(Sheets.Count)
shtname = Sheets(Sheets.Count) - 6
ActiveSheet.Name = shtname
Worksheets("99").Move After:=Sheets(Sheets.Count)
End Sub