Question
Within LeapYear Private Sub(): 1. Declare variables as needed 2. An InputBox should request the user to enter a year between 1901 and 2099 then
Within LeapYear Private Sub():
1. Declare variables as needed
2. An InputBox should request the user to enter a year between 1901 and 2099 then assign the input to a variable
3. The variable should be used to determine if it is a leap year
- If it is a leap year, then use Cells(R,C) to clear the cells holding 30 and 31.
- If it is not a leap year, then use Cells(R,C) to also clear the cell holding 29.
4. Place a button on each sheet and run the procedure on each sheet for each month of year 2012.
This is what I did:
Private Sub LeapYear()
Dim intYear As Integer (Declared variable) intYear = InputBox("Please enter the year of your recording (range between 1901 to 2099).") (asked for input box for the year) Select Case intYear (using select case for calculation) Case Is = intYear Mod 4 = 0 Cells(36, 1) = " " Cells(37, 1) = " " Case Is = intYear Mod 100 = 0 And intYear Mod 400 = 0 Cells(36, 1) = " " Cells(37, 1) = " " Case Is = intYear Mod 100 = 0 Cells(35, 1) = " " Cells(36, 1) = " " Cells(37, 1) = " " End Select
The part I am not sure about is the usage of select case in this case. Please don't suggest me anything like "If and then" or making it as a function instead and declaring as a boolean. Thank you!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started