Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If the range is optional then you need to include Optional in the Function so
that it does not return an error. You then test for its value in the code. Function ThisIsATest(MyRequiredRange As Range, _ Optional MyOptionalRange As Range) If MyOptionalRange Is Nothing Then 'code for optional range not included MsgBox "MyOptionalRange is Nothing" Else 'code if included MsgBox "MyOptionalRange is: " _ & MyOptionalRange.Address End If 'Alternatively If Not MyOptionalRange Is Nothing Then 'code here becaue it is included MsgBox "MyOptionalRange is: " _ & MyOptionalRange.Address Else 'code for optional range not included MsgBox "MyOptionalRange is Nothing" End If -- Regards, OssieMac |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
The name ... either conflicts with a valid range reference or isinvalid for Excel. | Excel Programming | |||
Conflict with Valid Range Reference Error in Microsoft Excel 2007 | Excel Programming | |||
Conflict with valid range reference error | Excel Discussion (Misc queries) | |||
Input cell reference is not valid (One Variable Data Table) | Excel Worksheet Functions | |||
Determine Valid Sample Size from a Population - Any UDFs or Formulas? | Excel Programming |