Hi All,
I need to loop an Input box until the User answers Yes
I ask for a year, and once the input is received I ask the year that has been entered is correct.
If the answer is Yes, then carry on with code, if the answer is No, then I want it to loop back to where is asks for the year again.
The code I have is :-
I need to loop an Input box until the User answers Yes
I ask for a year, and once the input is received I ask the year that has been entered is correct.
If the answer is Yes, then carry on with code, if the answer is No, then I want it to loop back to where is asks for the year again.
The code I have is :-
VBA Code:
Dim myYear As Integer
Dim Confirm As Integer
'Populate Cell R2 in Sheet named Forumula with the YYYY that will be entered by the User.
myYear = InputBox("Please enter the year (Format YYYY) that you want to create monthly Till Taking Sheets for and other associated files.", Title:=" Company Name")
Sheets("Formula").Select
Range("R2").Value = myYear
Confirm = MsgBox("The Year you want to create files for is " & myYear & " Is that correct?", vbQuestion + vbYesNo + vbDefaultButton2, Title:=" Company Name")
If Confirm = vbYes Then
MsgBox "The Year you want to create files for is " & myYear & " Is that correct?", vbQuestion + vbYesNo + vbDefaultButton2, Title:=" Company Name "
Else
[COLOR=rgb(0, 0, 0)][B] Don’t know how to get back to the above InputBox[/B][/COLOR]
End If