Mistype error message
VBA Telemetry pings you when your VBA projects fail
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Mistype error message

  1. #1
    Guest

    Default

     
    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
    Location
    Denver, Colorado USA
    Posts
    4,240
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    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
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

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
  •  

 

 
DMCA.com