+ Reply to Thread
Results 1 to 6 of 6

Help with a "type mismatch" error in a macro

  1. #1
    Forum Contributor
    Join Date
    12-11-2014
    Location
    Missouri
    MS-Off Ver
    2016
    Posts
    153

    Help with a "type mismatch" error in a macro

    Hi All,

    I have a worksheet that receives imported data from another worksheet. Occasionally there are invalid dates imported and we want
    to delete those rows with the macro below. The expectation is that it deletes all dates prior to 1/1/2021.
    It does the job as expected BUT I'm getting a type mismatch error when the macro has finished and I'm not sure why?
    I assumed it was date format but have tried every which way to no avail.

    Any help would be great.
    Thanks,
    D

    Please Login or Register  to view this content.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,917

    Re: Help with a "type mismatch" error in a macro

    Do you have text headers in row 1?

    If so, try amending this line:
    Please Login or Register  to view this content.
    To this:
    Please Login or Register  to view this content.
    BSB

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,770

    Re: Help with a "type mismatch" error in a macro

    I have run your code without any problem BUT you did not define what an invalid date is - simply less than 01/01/2021?

    With valid Excel dates it worked OK
    Last edited by JohnTopley; 01-16-2022 at 02:49 PM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Forum Contributor
    Join Date
    12-11-2014
    Location
    Missouri
    MS-Off Ver
    2016
    Posts
    153

    Re: Help with a "type mismatch" error in a macro

    That did the trick. THANK YOU!

  5. #5
    Forum Contributor
    Join Date
    12-11-2014
    Location
    Missouri
    MS-Off Ver
    2016
    Posts
    153

    Re: Help with a "type mismatch" error in a macro

    I was able to get it. As previous post indicated "Text Headers" were causing and issue in Row 1. Thank you!

  6. #6
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,917

    Re: Help with a "type mismatch" error in a macro

    Happy to help

    BSB

+ 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] Code displays error message reading "type mismatch"
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-12-2014, 09:32 AM
  2. Excel 2010 (Run-time error '13' type mismatch) "Debug" and "Continue" Grayed out.
    By Jeronimo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2012, 06:42 PM
  3. [SOLVED] VBA Excel 2007 : Autofit Merge Cells Error "Run-time error '13': Type Mismatch"
    By Hudas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-18-2012, 04:10 PM
  4. Replies: 5
    Last Post: 08-08-2010, 03:03 PM
  5. "Type mismatch"-error with a short test-version of mail macro
    By JohannesEngelbert in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-14-2010, 11:55 AM
  6. Merged cells cause "Runtime error 13 type mismatch" problem
    By Ralph Malph in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2006, 08:55 AM
  7. Error Handling to mitigate "Run Time Erorr 13 Type Mismatch"
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-16-2005, 09:05 AM

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