gkisystems
Board Regular
- Joined
- Apr 20, 2012
- Messages
- 76
I have some VBA code that asks the user to input the year of the report in the format of YYYY. How do I restrict the code so that the user can only input a year between 2014-2050? For example, I do not want the user to type in 15 for the year 2015.
Here is the code I have so far:
I also need to figure out how to do code similar to the above for the user to figure out the QTR (either 1, 2, 3, or 4). One way of doing it might be to give the user a list with radio buttons next to Q1, Q2, Q3, Q4 for example. However, I'm not sure how to do that. Any help is appreciated.
Here is the code I have so far:
Code:
'Ask user to provide the current Year and apply it to the data automatically.
Dim myYear As String
myYear = InputBox("Please key in the report year (''YYYY'' format) like 2015 for example:")
Range("B2:B" & Lastrow).Value = myYear
I also need to figure out how to do code similar to the above for the user to figure out the QTR (either 1, 2, 3, or 4). One way of doing it might be to give the user a list with radio buttons next to Q1, Q2, Q3, Q4 for example. However, I'm not sure how to do that. Any help is appreciated.