LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Calling a Custom Function within a Procedure

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 Procedu

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run external workbook function/procedure? Vinod Excel Discussion (Misc queries) 3 August 10th 09 02:03 PM
Calling a function in my SQL-DB from VBA KSor Excel Discussion (Misc queries) 0 March 11th 09 02:08 PM
Create a procedure or function Alexandra Lopes Excel Worksheet Functions 0 November 19th 08 10:00 AM
Calling procedure when leaving cell jeffP Excel Worksheet Functions 5 February 9th 06 08:59 AM


All times are GMT +1. The time now is 09:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"