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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!