+ Reply to Thread
Results 1 to 11 of 11

Run-time error '13' - Mismatch

  1. #1
    Registered User
    Join Date
    11-17-2009
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 365
    Posts
    66

    Run-time error '13' - Mismatch

    Relatively new to VBA...so I appreciate the assistance.

    Aquired a template to parse by column. Everything works fine on the "Original" tab, where column C (or 3 in the code) is parsed. When I change the code in the ParseByColumn macro to Col = 12 in order to parse column L in the "New" tab, it will return a runtime error and say there is an issue with the following line:

    Rows(Rw + 1 & ":" & Rw + UBound(MyArr)).Insert xlShiftDown

    The macro in the attached sheet is currently set to column 3.

    What am I doing incorrect here?

    Thanks...
    Attached Files Attached Files
    Last edited by Figboot; 04-26-2011 at 10:25 AM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,257

    Re: Run-time error '13' - Mismatch

    Your data at the bottom of column L does not contain any of the delimiters you check for so you never populate the MyArr variant with an array (or indeed with anything), and you can't therefore use Ubound on it. Add an Else condition:
    Please Login or Register  to view this content.
    and then you should be OK.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    11-17-2009
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 365
    Posts
    66

    Re: Run-time error '13' - Mismatch

    Sorry...excellent with functions but a newbie with VBA. Where in this code should I add the line? I greatly appreciate the help!
    Please Login or Register  to view this content.
    Last edited by romperstomper; 04-26-2011 at 09:25 AM. Reason: code tags

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,257

    Re: Run-time error '13' - Mismatch

    Before the End If line.

    Note: I have added code tags to your last post. Please make sure you use them in future whenever you post code, in accordance with forum rules.

  5. #5
    Registered User
    Join Date
    11-17-2009
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 365
    Posts
    66

    Re: Run-time error '13' - Mismatch

    Okay...it now errors on this line:

    Please Login or Register  to view this content.

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

    Re: Run-time error '13' - Mismatch

    if the parsing delimiter is a comma, this may suffice:

    Please Login or Register  to view this content.
    if the parsing delimiter is a semicolon
    Please Login or Register  to view this content.
    Last edited by snb; 04-26-2011 at 09:47 AM.



  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,257

    Re: Run-time error '13' - Mismatch

    You have some cells that are empty in column L - how do you want those handled?

  8. #8
    Registered User
    Join Date
    11-17-2009
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 365
    Posts
    66

    Re: Run-time error '13' - Mismatch

    Yes, it is a comma. Am I replacing the code that errored, or placing this somewhere else?

    Thanks for your patience!

  9. #9
    Registered User
    Join Date
    11-17-2009
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 365
    Posts
    66

    Re: Run-time error '13' - Mismatch

    If a row has column L empty, then it can either be ignored, or just parsed once...really doesn't matter.

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,257

    Re: Run-time error '13' - Mismatch

    In that case:
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    11-17-2009
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 365
    Posts
    66

    Re: Run-time error '13' - Mismatch

    Outstanding! Works great. I greatly appreciate the assistance.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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