+ Reply to Thread
Results 1 to 6 of 6

Macro gives Run-time error '13': Type mismatch, but nothing has changed?

  1. #1
    Registered User
    Join Date
    09-05-2010
    Location
    Massachusetts (USA)
    MS-Off Ver
    Excel 2007
    Posts
    44

    Question Macro gives Run-time error '13': Type mismatch, but nothing has changed?

    I have a macro that I use to run an End of Day (EOD) Report. I have been using it for weeks now without a problem, but tonight it seems to bind up when I run it, giving me the error:

    Run-time error '13': Type mismatch

    I click debug to look at the code, but I have no idea what it's referring to since, well, nothing has changed either in the macro or reporting data output (as far as I know).

    Attached is tonight's report in raw format (pre-macro run) with the macro enabled so the error can be duplicated. It's killing me not knowing what's wrong and I am hoping the problem is not between the chair and keyboard.

    Any help is appreciated.
    Attached Files Attached Files
    Last edited by BlondOIverBlue; 11-10-2010 at 11:47 PM. Reason: Marking as solved.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro gives Run-time error '13': Type mismatch, but nothing has changed?

    Hi BlondOIverBlue

    Your macro balks at this line of code
    Please Login or Register  to view this content.
    Some of your "Start Times" in column L are blank. It appears that this may be causing your issue.

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    09-05-2010
    Location
    Massachusetts (USA)
    MS-Off Ver
    Excel 2007
    Posts
    44

    Red face How to get macro to ignore blank "start time" fields

    Quote Originally Posted by jaslake View Post
    Hi BlondOIverBlue

    Some of your "Start Times" in column L are blank. It appears that this may be causing your issue.

    John
    Ok, that makes sense, but that never stopped the macro before which is why I was being thrown for a loop. Since it doesn't like blank "Start Time" fields, how do I get it to ignore blank start time fields?

    Currently it takes 07:00 into account as the default start time for everyone and should be calculating "total hours" using that plus the highest "end time". Then it subtracts 0.50 hours to account for a meal break.

    I'm not a programmer and am still learning coding (via this macro other helped me write) so I apologize if I'm asking too many questions.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro gives Run-time error '13': Type mismatch, but nothing has changed?

    Hi BlondOIverBlue

    If you wish to
    how do I get it to ignore blank start time fields?
    Change your code as follows
    Please Login or Register  to view this content.
    I've indicated which lines (3) of code need to be added. The code will now ignore blank start times.

    Hope this helps.

    John

  5. #5
    Registered User
    Join Date
    09-05-2010
    Location
    Massachusetts (USA)
    MS-Off Ver
    Excel 2007
    Posts
    44

    Thumbs up Re: Macro gives Run-time error '13': Type mismatch, but nothing has changed?

    Quote Originally Posted by jaslake View Post
    Change your code as follows
    Please Login or Register  to view this content.
    I've indicated which lines (3) of code need to be added. The code will now ignore blank start times.
    Brilliant! Those 3 little lines worked! Thank you so much!

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro gives Run-time error '13': Type mismatch, but nothing has changed?

    Hi BlondOIverBlue

    You're welcome. If your issue is resolved, please mark it as such.

    To mark your thread solved do the following:
    - Go to your first post on the thread
    - Click edit
    - Click Advance
    - Just below the word "Title:" you will see a dropdown with the word No prefix.
    - Change to Solve
    - Click Save

    A click on the scales is always appreciated.

    John

+ 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