View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
ker_01 ker_01 is offline
external usenet poster
 
Posts: 395
Default Function Declarations !!!!!!!!!!!!!!!!!!!!!!

The key thing to remember is that every variable you declare after the first
optional parameter will also be optional (you cannot have required, then
optional, then required)

Here is a real one from one of my workbooks:
Function PullAllRawData(SourceSheet As Worksheet, _
DestSheet As Worksheet, _
Optional PathOnly As String, _
Optional MyFullFilePath As String, _
Optional TitleString As String)

In this case, it isn't a UDF, but I'd expect it should work the same way.

HTH,
Keith

"Ayo" wrote:

How do you declare a variable as OPTIONAL in a UDF. I have a function that I
use in one of my macros but I would like to declare at least one of the
variables as an optional variable. I am not sure how to do that.
Any ideas?

Thanks
Ayo