+ Reply to Thread
Results 1 to 6 of 6

Filing Macro - Run time error '13: Type Mismatch

  1. #1
    Registered User
    Join Date
    08-07-2013
    Location
    Liverpool
    MS-Off Ver
    Excel 2010
    Posts
    9

    Lightbulb Filing Macro - Run time error '13: Type Mismatch

    Hi All,

    I've been working on this code for a while and can't seem to get it right. The code basically copies the integer value from one cell and deposits it in another worksheet. The problem I'm getting is a 'Run time error '13: Type Mismatch' although it doesn't seem to be this, to my knowledge anyway.

    The code is as follows;
    Please Login or Register  to view this content.
    The message box displays the values in the column first defined, in this case "E". It doesn't appear to be seeing the 'Else' statement, it just seems to give the error if there is nothing in the "E" column. An example of this is that the message box provides the values from the "E" column, up until a "D" column value is present, at this point an error message pops up. If I go into debug I can change the first 3 lines of code to "D", ref below;
    Please Login or Register  to view this content.
    The code will execute and values appear in the message box.

    This has been going on for months, some help would be hugely appreciated!

    Look forward to your reply guys and girls, and thanks in advance.

    Best,
    W

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Filing Macro - Run time error '13: Type Mismatch

    Where exactly is the error occuring?

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    08-07-2013
    Location
    Liverpool
    MS-Off Ver
    Excel 2010
    Posts
    9

    Lightbulb Re: Filing Macro - Run time error '13: Type Mismatch

    Hi Norie,

    Thank you for replying so quickly.

    I've uploaded the whole work book. The reason I've done this is the code on a few test worksheets works, it's just with the work sheet I need it to work on, it doesn't. I have a feeling it might be a data issue, but if it is, I am still unsure how I would correct it.

    If you want to look at the 'Transactions' and 'Table2' tabs for the working code. If you want to look at the 'BR(D)' and 'DACG (DCard)' tab for the code which isn't working.

    The code is suppose to take income and expenditure out of the bank statement and filing them in the according worksheet. It works in the example but not in the actual and I don't know why, the code is identical, bar the cell referencing.
    Non Private Version.xlsm
    Best,

    W

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Filing Macro - Run time error '13: Type Mismatch

    I can't reproduce the error in the sub btnBRDTest but the code does get stuck in an (almost) infite loop.

    That's because the range being looped through, ddate, consists of the range $A$637:$A$1048576 which is like almost 1 million lines.

    However on the 'BR(D)' sheet there's only 80ish rows of data, starting in row 2.

    Have you cut a lot of data from the file?

  5. #5
    Registered User
    Join Date
    08-07-2013
    Location
    Liverpool
    MS-Off Ver
    Excel 2010
    Posts
    9

    Post Re: Filing Macro - Run time error '13: Type Mismatch

    Hi Norie,

    I've uploaded an adjusted version that provides the error. I simply changed the range for ddate to $A$66. This works fine for the purpose of displaying the error. If, however, once the error is adjusted it's going to be stuck in the loop again, how would you recommend stopping this from occurring?

    I have cut a lot of data, only because the file size was so large. It went back to May of last year.

    Please see attached.

    Best,
    W
    Attached Files Attached Files

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Filing Macro - Run time error '13: Type Mismatch

    The problem is the text '- ' that you have in some cells.

    Note that space after the dash is meant to be there.

    If you change the code to this you should get no error.
    Please Login or Register  to view this content.
    As for getting stuck in a loop, that was only because of the missing data.

    Mind you rather than using xlDown it's usually better to use xlUp.

    For example, if you wanted dddate to include all rows with data in column A from row 2 down.
    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)

Similar Threads

  1. [SOLVED] run time error 13 type mismatch when running VB macro in Excel 97
    By bkwins in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2013, 04:41 AM
  2. [SOLVED] "Run-time error '13': type mismatch when running macro to add text to end of text
    By nrjordan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2012, 10:34 PM
  3. Re: Help with a macro- 'Run-Time error '13' Type Mismatch
    By pman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-16-2012, 03:31 PM
  4. Macro gives Run-time error '13': Type mismatch, but nothing has changed?
    By BlondOIverBlue in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-10-2010, 11:52 PM
  5. [SOLVED] Visual Basic macro run time error(13) type mismatch
    By Paul in forum Excel General
    Replies: 0
    Last Post: 10-25-2005, 03:05 AM

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