Dim Month As Integer
Month = UserForm1.ComboBox2.Value
Call LeapYear(Month)
End Sub
Private Sub LeapYear(Month As Integer)
Dim ComboBox4 As Integer
Dim myArray() As Long
Dim i As Integer
UserForm1.ComboBox4.Clear
ReDim myArray(31)
Dim thisDay As Date
Dim myDay As String
Dim LngDay As Long
thisDay = Format(Date, "yyyy/mm/dd")
myDay = Mid(CStr(thisDay), 9, 2)
LngDay = CLng(myDay)
Select Case Month
Case 1, 3, 5, 7, 8, 10, 12
For i = 0 To 31
myArray(i) = LngDay + i
If myArray(i) > 31 Then
Exit Sub
Else
UserForm1.ComboBox4.AddItem myArray(i)
End If
Next i
UserForm1.ComboBox4.AddItem myArray(i)
Case 4, 6, 9, 11
For i = 0 To 30
myArray(i) = LngDay + i
If myArray(i) > 30 Then
Exit Sub
Else
UserForm1.ComboBox4.AddItem myArray(i)
End If
Next i
Case Else
For i = 0 To 28
myArray(i) = LngDay + i
If myArray(i) > 28 Then
Exit Sub
Else
UserForm1.ComboBox4.AddItem myArray(i)
End If
Next i
End Select
End Sub
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。