![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
I have a function which passes in three reference values
Private Function CommonRow(ByRef iArrayi() As Long, _ ByRef iArrayj() As Long, _ ByRef iArrayk() As Long) As Long Inside the function, I want to do a if...else loop with condition like when iArrayi()doesn't exist, iArrayj() doesn't exist or iArrayk() doesn't exist So I put If Not iArrayi() Is Nothing Then But I got an error message "Mistype" when I run the macro Could someone please help me Thanks in advance |
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
|
If you mean that you want to know if an array has been passed as an argument or not, the code should be:
Private Function CommonRow(Optional iArrayi() As Long, _ iArrayj() As Long, _ iArrayk() As Long) As Long and then you can test whether an array argument is missing: If IsMissing(iArrayi) Then ... I also eliminated the ByRef keywords because ByRef is the default for arrays.
__________________
Keep Excelling. Damon VBAexpert Excel Consulting (My other life: http://damonostrander.com ) |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|