Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Mistype error message

  1. #1


    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. #2
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Denver, Colorado USA
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)


    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.


    VBAexpert Excel Consulting
    LinkedIn Profile
    AllExperts Profile

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts