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: 510
Default Excel2000: How to check for Optional parameter=Nothing

Hi

I have a function declared as:
----
Public Function EnchWorkdaysN(StartDate As Date, _
EndDate As Date, _
Optional Holidays As Variant = Nothing, _
Optional Weekends As Variant = Nothing)
....
End Function
----

How to check in code for optional parameters set to Nothing? When I used the
code
....
If Holidays Is Nothing Then
statement
Elseif ...
.....

then it works only, when I omit the parameter or when I leave it empty, i.e.
when the parameter is set to Nothing. But when the the optional parameter
has some value, the the VBA cancels at first test without any error message.
When I test in debug window p.e. for 'Holidays Is Nothing', then instead of
False, <Object required is returned. And the same with 'Not(Holidays Is
Nothing)' too.


Thanks in advance
--
When sending mail, use address arvil<attarkon.ee
Arvi Laanemets



 
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
Can you spell check protected but unlocked cells in excel2000? MarkB Excel Discussion (Misc queries) 1 October 3rd 06 05:36 PM
format optional parameter compound Excel Worksheet Functions 0 September 26th 05 10:55 PM
format optional parameter compound Excel Discussion (Misc queries) 0 September 16th 05 06:20 PM
Excel2000: Declaring function parameter as an array Arvi Laanemets Excel Programming 6 April 25th 05 01:14 PM
Excel2000: UDF's parameter as cell range OR array Arvi Laanemets Excel Programming 2 April 19th 05 02:27 PM


All times are GMT +1. The time now is 07:04 AM.

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"