From: Prof Wonmug on 30 Apr 2010 00:41 If I code a Function statement Function Temp(Optional abc As Single) then calling the function with no arguments =temp() [abc] gets assigned the value "0" and the IsMissing(abc) test always fails. If I change the Function statement to Function Temp(Optional abc) then everything works. Is there no way to have an optional numeric argument and be able to assign the default in the function?
From: Rick Rothstein on 30 Apr 2010 00:49 Methinks someone did not read the help files for IsMissing... <g> -- Rick (MVP - Excel) "Prof Wonmug" <wonmug(a)e.mcc> wrote in message news:0bnkt5lc8kgm4j55a3aqid191m9v3hl2fc(a)4ax.com... > If I code a Function statement > > Function Temp(Optional abc As Single) > > then calling the function with no arguments > > =temp() > > [abc] gets assigned the value "0" and the IsMissing(abc) test always > fails. If I change the Function statement to > > Function Temp(Optional abc) > > then everything works. > > Is there no way to have an optional numeric argument and be able to > assign the default in the function?
From: Prof Wonmug on 30 Apr 2010 01:12 On Fri, 30 Apr 2010 00:49:13 -0400, "Rick Rothstein" <rick.newsNO.SPAM(a)NO.SPAMverizon.net> wrote: >Methinks someone did not read the help files for IsMissing... <g> When I click on the Help button from the VBA IDE, I get "This page is not available". It's been that way for quite a few days. I also searched online for "VBA IsMissing" and "VBA Optional Arguments" and a few others. I could not find anywhere that it mentioned anything about IsMissing and datatypes. I finally found something on VB.Net (which I am not running) about IsMissing not being supported and it showed an example of assigning a default value on the Function statement: Function Temp(Optional abc As Single = 1) That fixed the problem. Thank you so much. You have been very helpful....not
From: Rick Rothstein on 30 Apr 2010 01:25 You could have mentioned that you tried to look it up and that your help files were not working... we tend to try to direct questioners to the help files in those cases where the help files provides a complete answer. Here is an link to the online IsMissing help file... http://msdn.microsoft.com/en-us/library/aa445048(v=VS.60).aspx -- Rick (MVP - Excel) "Prof Wonmug" <wonmug(a)e.mcc> wrote in message news:hdpkt5dp73qjclng828rrksnlhbjqfq3a4(a)4ax.com... > On Fri, 30 Apr 2010 00:49:13 -0400, "Rick Rothstein" > <rick.newsNO.SPAM(a)NO.SPAMverizon.net> wrote: > >>Methinks someone did not read the help files for IsMissing... <g> > > When I click on the Help button from the VBA IDE, I get "This page is > not available". It's been that way for quite a few days. > > I also searched online for "VBA IsMissing" and "VBA Optional > Arguments" and a few others. I could not find anywhere that it > mentioned anything about IsMissing and datatypes. > > I finally found something on VB.Net (which I am not running) about > IsMissing not being supported and it showed an example of assigning a > default value on the Function statement: > > Function Temp(Optional abc As Single = 1) > > That fixed the problem. > > Thank you so much. You have been very helpful....not
|
Pages: 1 Prev: Excel VB application Next: XL2007 (or 2003): Triggering SelectionChange event |