G
Guest
I have a Macro that prompts the user for a number. The program should then
insert a copy of an existing page that number of times. The program prompts
the user, but then stops before inserting any new pages. Here is what I have
right now. Thank you for all your help!!
Sub CopySheets()
Dim PhaseNum As Double
Dim Count As Double
Dim MinVal As Double
Dim MaxVal As Double
Dim Msg As String
Dim UserEntry As String
MinVal = 1
MaxVal = 20
Msg = "Enter the Number of Program Phases"
Msg = Msg + vbNewLine
Msg = Msg + "Between 1 and 20"
Do
UserEntry = InputBox(Msg)
If UserEntry = "" Then Exit Sub
If IsNumeric(UserEntry) Then
PhaseNum = Val(UserEntry)
If PhaseNum <= MaxVal And PhaseNum >= MinVal Then Exit Do
End If
Loop
For Count = 1 To PhaseNum
Sheets("INPUT").Select
Sheets("INPUT").Copy After:=Sheets("INPUT")
Next Count
End Sub
insert a copy of an existing page that number of times. The program prompts
the user, but then stops before inserting any new pages. Here is what I have
right now. Thank you for all your help!!
Sub CopySheets()
Dim PhaseNum As Double
Dim Count As Double
Dim MinVal As Double
Dim MaxVal As Double
Dim Msg As String
Dim UserEntry As String
MinVal = 1
MaxVal = 20
Msg = "Enter the Number of Program Phases"
Msg = Msg + vbNewLine
Msg = Msg + "Between 1 and 20"
Do
UserEntry = InputBox(Msg)
If UserEntry = "" Then Exit Sub
If IsNumeric(UserEntry) Then
PhaseNum = Val(UserEntry)
If PhaseNum <= MaxVal And PhaseNum >= MinVal Then Exit Do
End If
Loop
For Count = 1 To PhaseNum
Sheets("INPUT").Select
Sheets("INPUT").Copy After:=Sheets("INPUT")
Next Count
End Sub