2 user-defined function questions

patl

Board Regular
Joined
Dec 15, 2005
Messages
123
If a function accepts a variant, how can you tell on the function side if the variant is a Range?

Also, is there a way to compile user-defined functions and put them in a global library? Thanks a lot.
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
L

Legacy 98055

Guest
If a function accepts a variant, how can you tell on the function side if the variant is a Range?

Try this UDF to understand and see "TypeName" in VBA help for more info...

Code:
Public Function IsRange(Arg As Variant) As Boolean
    IsRange = (VBA.TypeName(Arg) = "Range")
End Function


Also, is there a way to compile user-defined functions and put them in a global library?

You can place them in a standard module withing Personal.xls, in an Excel addin, or as a COM addin...

Tom
 

Watch MrExcel Video

Forum statistics

Threads
1,119,128
Messages
5,576,253
Members
412,709
Latest member
Rishu
Top