First I want to say hello and thanks for any help I may receive,
The company I work for uses excel with macros a lot! I decided to try to make my own today modifying some code that I've found on the web. What I am trying to do is prompt a user to name the beginning sheet, then copy that sheet x times (prompt user) while incrementing the name.
Example user types "B1-01", then user enters 4 for number of copies and the results are sheets B1-01, B1-02, B1-03, B1-04, B1-05
Some code found on this site from thread:
http://www.excelforum.com/excel-prog...-3-digits.html
What I have so far: (Yes I know, I have no clue what I'm doing, I just took a java class in high school and trying to remember/adapt)
Sub Commissioning_Sheet_Maker()
Dim n As String
Dim i As Integer
Dim p As Integer
' On Error GoTo out
n = InputBox("Enter Sheet Name:", "Naming")
i = InputBox("How many copies do you what?", "Making Copies")
Application.ScreenUpdating = False
p = 0
ActiveSheet.Name = n
Do
SheetName = n
MyNum = CInt(Right(SheetName, 2))
MyCount = Worksheets.Count
Sheets(n).Select
Sheets(n).Copy After:=Sheets(MyCount)
Sheets(n).Select
Sheets(n).Name = n + Format(MyCount + 1, "00")
p = p + 1
Loop Until p = i
Application.ScreenUpdating = True
Exit Sub
out:
MsgBox "copy was cancelled"
Application.ScreenUpdating = True
End Sub
Bookmarks