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: 112
Default Optional Argument anomaly?

Have run across a problem with an optional variant.

Code Example:

Function X (A As Range, Optional B As Variant = ?) As Variant

If IsEmpty(B) Then MsgBox "B is Empty"
If IsNull(B) Then MsgBox "B is Null"
If IsError(B) Then MsgBox "B is Error"

If the optional argument "B" is initialized to "Null" (i.e. Optional B As
Variant = Null) then the message "B is Null" is displayed. However, if "B"
is initialized to "Empty" (i.e. Optional B As Variant = Empty), the "IsEmpty"
is false and the message "B is Error" is displayed.

Does anyone know why the initialization of "B" to "Empty" results in an error?

Thanks.
 
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
Argument not optional Arne Hegefors Excel Programming 4 August 30th 06 04:08 AM
Argument not optional Error 449! Need Help bad_boyu Excel Programming 3 July 26th 06 12:52 PM
Don't understand why I'm getting an argument not optional Brett Smith[_2_] Excel Programming 2 February 8th 06 02:05 PM
Compile Error: Argument not optional Brett Smith[_2_] Excel Programming 1 January 19th 06 05:39 PM
optional argument in a function visitor Excel Programming 4 May 13th 05 07:41 PM


All times are GMT +1. The time now is 11:48 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"