T
terryspencer2003
I am trying to call a function within a procedure. I can't seem to
get it to work. What am I doing wrong. Here is the function:
Private Function IsLeapYear(Y As Integer)
IsLeapYear = Month(DateSerial(Y, 2, 29)) = 2
End Function
Here is the Procedure:
Sub Simulation()
Dim BeginningYear As Integer
BeginningYear = 2003
If IsLeapYear(BeginningYear) = True Then HoursinYear = 8784
Else: HoursinYear = 8760
End If
End Sub
I keep getting an error message saying "Compile Error:Expected Array".
It then highlights the "IsLeapYear" within my If statement.
Can anyone tell me what I am doing wrong?
TS
get it to work. What am I doing wrong. Here is the function:
Private Function IsLeapYear(Y As Integer)
IsLeapYear = Month(DateSerial(Y, 2, 29)) = 2
End Function
Here is the Procedure:
Sub Simulation()
Dim BeginningYear As Integer
BeginningYear = 2003
If IsLeapYear(BeginningYear) = True Then HoursinYear = 8784
Else: HoursinYear = 8760
End If
End Sub
I keep getting an error message saying "Compile Error:Expected Array".
It then highlights the "IsLeapYear" within my If statement.
Can anyone tell me what I am doing wrong?
TS