I want the entire Private Sub to Exit if the Copier routine is exited. So the DoDays routines is never called.
Sub Copier()
Dim x As String
Dim z As Integer
x = InputBox("Enter Number of Days in Month")
If x = "" Then
MsgBox "User Pressed Cancel!" & vbCrLf & _
"or did not enter a value!", vbOKOnly + vbInformation, _
"Inputbox Result:"
z = 10
Exit Sub
ElseIf CInt(x) = 0 Then
MsgBox "User Pressed Cancel!" & vbCrLf & _
"or did not enter a value!", vbOKOnly + vbInformation, _
"Inputbox Result:"
z = 10
Exit Sub
Else: End If
y = CInt(x) - 1
For numtimes = 1 To y
ActiveWorkbook.Sheets("Sheet1").Copy _
after:=ActiveWorkbook.Sheets("Sheet1")
Next
DoDays
End Sub
Private Sub COPY_NUMBER_Click()
COPY_NUMBER.BackColor = 12713921
Copier
' DoDays
COPY_NUMBER.BackColor = 12500670
COPY_NUMBER.Enabled = False
End Sub
The call to the DoDays in the Copier sub doesn't seem to work because I literally need to exit the Private Sub so the button remains enabled.
I would merge the
Copier
procedure into theCOPY_NUMBER_Click
event procedure: