Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming,comp.apps.spreadsheets,microsoft.public.excel.misc
|
|||
|
|||
![]()
See the help for Functions
You are just talking about optional arguments. Function MyFunc(MyStr As String, Optional MyArg1 As _ Integer = 5, _ Optional MyArg2 = "Dolly") Dim RetVal ' The function can be invoked as follows: RetVal = MyFunc("Hello", 2, "World") ' All 3 arguments supplied. RetVal = MyFunc("Test", , 5) ' Second argument omitted. ' Arguments one and three using named-arguments. RetVal = MyFunc(MyStr:="Hello ", MyArg1:=7) The arglist argument has the following syntax and parts: [Optional] [ByVal | ByRef] [ParamArray] varname[( )] [As type] [= defaultvalue] Part Description Optional Optional. Indicates that an argument is not required. If used, all subsequent arguments in arglist must also be optional and declared using the Optional keyword. Optional can't be used for any argument if ParamArray is used. -- Regards, Tom Ogilvy "Frederik Romanov" wrote in message om... Excel-97 (SR-2) In general I would like to write macros that can be overloaded, for example Hyperlink() has an optional displaytext field. HyperLink( Filename) HyperLink( Filename, DisplayText) Please could someone post a short, useful macro that does such a thing, rather than give a description of how to do so. I have searched the online help for "overloading" and "arguments" but nothing useful is shown there. TIA, Fred. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Passing Arguments in Excell | Excel Worksheet Functions | |||
Passing Arguments in Excell function | Excel Discussion (Misc queries) | |||
Passing Variable Number of Arguments to a Sub | Excel Discussion (Misc queries) | |||
passing arguments from an excel macro to a word macro | Excel Discussion (Misc queries) | |||
Passing Variable to LINEST | Excel Worksheet Functions |