Question about Optional Parameters and Variant
I am somewhat new to VBA, and I could swear I read something where it said that if I wanted to use the isMissing function against a certain parameter, that parameter had to be declared as variant in the function statement.
Is that true? I thought I read that somewhere, but now I can't find somethign to verify it. Although, by change one of my optional parameters from Range to Variant did solve the error message, so I am leaning towards yes.
If that is the case doesn't that mean you will have to declare all optional parameters variant, since you have to test to see if your parameter was included or not in the function?
Re: Question about Optional Parameters and Variant
No.... because you can set a default value for optional parameters. That's what I do, I never declare parameters as variant, even optional ones. I set them to a default value, then test for that value to see if the parameter was actualy passed.
Optional byref MyNewRange As Range = Nothing
Then if you check to see if MyNewRange Is Nothing, then it wasn't passed. If it isn't nothing, then it was passed in.
Tg
Re: Question about Optional Parameters and Variant
ok, I see, I didn't know you could set the default optional parameter value within the parameter list like that. Thanks, I think I'll do that.