Pam in TX
10-11-2007, 02:20 PM
I need assistance with the following Macro......... I want to create multiple copies of a sheet called "data" based on variable criteria....place them after the data sheet.... If they could be renamed data1, data2, etc. that would be an added bonus...... What I have now simply creates blank sheets............. Thanks in advance.....
Sub AddHowMany()
' Turns the screen off while the Macro is running.
Application.ScreenUpdating = False
'Prompt user for total number of new sheets needed, then repeats based on answer
totalsheets = InputBox("How many copies of the worksheet do you want to create?")
For X = 1 To totalsheets
Worksheets.Add After:=Worksheets(Worksheets.Count), Count:=X
Next X
'Turns the screen back on when the Macro is finished.
Application.ScreenUpdating = True
End Sub
EDIT: Added VBA tags Tommy
Sub AddHowMany()
' Turns the screen off while the Macro is running.
Application.ScreenUpdating = False
'Prompt user for total number of new sheets needed, then repeats based on answer
totalsheets = InputBox("How many copies of the worksheet do you want to create?")
For X = 1 To totalsheets
Worksheets.Add After:=Worksheets(Worksheets.Count), Count:=X
Next X
'Turns the screen back on when the Macro is finished.
Application.ScreenUpdating = True
End Sub
EDIT: Added VBA tags Tommy