jamescooper
Well-known Member
- Joined
- Sep 8, 2014
- Messages
- 840
Code:
Sub Clean_Data()
Dim myValue As Variant
Dim myValue2 As Variant
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim FP As String, FN As String
myValue = InputBox("Enter the railway period, e.g. 1804")
myValue2 = InputBox("Enter the date you wish to clean the data in format yyyy-mm-dd e.g. 2017-06-28")
I am trying to prevent the code from bringing up the error message on the following Input box above.
In the first if the 'myvalue' is not in a list how would I make the user try again? Also where would I put this list, could I put it in the code?
2nd, on myvalue2 if it is an error how do I make them enter again until correct.
3rd if they click "Cancel" how does it exit the macro?
Many thanks in advance.