+ Reply to Thread
Results 1 to 7 of 7

Fixing Type Mismatch Error in argument passing

  1. #1
    Registered User
    Join Date
    03-11-2013
    Location
    colombia
    MS-Off Ver
    Excel 2007
    Posts
    18

    Fixing Type Mismatch Error in argument passing

    I'm passing a ListObject to a macro but I bump into a probably obvious error, I clearly missed something.

    I run a vba macro in Excel 2007

    The exact error I get is "Compilation Error: Type Mismatch" This happens when I am passing a ListObject as argumento to the macro
    CopyFilteredTable.


    Below you find the macro

    Thanks in advance:

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    01-03-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: Fixing Type Mismatch Error in argument passing

    From MS Excel VBA Help:
    If you use the Call keyword to call a procedure that requires arguments, argumentlist must be enclosed in parentheses. If you omit the Call keyword, you also must omit the parentheses around argumentlist.

  3. #3
    Registered User
    Join Date
    03-11-2013
    Location
    colombia
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Fixing Type Mismatch Error in argument passing

    Thanks Sbarro79.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Fixing Type Mismatch Error in argument passing

    I noticed that there is a space between the call and the argument - that should not be - I've found that you don't need the "Call" keyword when there is only one argument - so, I think that if you omit the space, then the code will work????
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Forum Contributor
    Join Date
    01-03-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: Fixing Type Mismatch Error in argument passing

    Hi xladept

    I tried your suggestion and removed that space, but Excel put it back again, so it did not work.
    Apparently it must be like help says:
    you use Call keyword - procedure name, no space, argument(s) in parentheses
    you don't use Call keyword - procedure name, space, argument(s) with no parentheses

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Fixing Type Mismatch Error in argument passing

    @Sbarro

    Thanks for trying it out. I've still got the NB mindset

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Fixing Type Mismatch Error in argument passing

    Why not simply:

    Please Login or Register  to view this content.



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1