+ Reply to Thread
Results 1 to 3 of 3

macro works in excel 2019 but not in 2010 this gives type mismatch error 13

  1. #1
    Registered User
    Join Date
    01-16-2016
    Location
    NW England
    MS-Off Ver
    2010
    Posts
    16

    macro works in excel 2019 but not in 2010 this gives type mismatch error 13

    Hi All

    My Macro stopped working in Excel 2010 but is ok in Excel 2019.

    Sub xlDelDP()
    Dim ws As Worksheet, cell As Range, rng As Range
    Set ws = ThisWorkbook.Sheets("Offences")
    lrow = ws.Range("A" & Rows.Count).End(xlUp).Row
    Set rng = Sheets("Offences").Range("A2:A" & lrow)
    For i = lrow To 2 Step -1
    Set cell = ws.Range("A" & i)
    If CDate(cell) <= Date - 365 Then cell.EntireRow.Delete
    Next
    Sheets("Front").Activate
    End Sub

    Its purpose is to delete data older than 12 months for Data Protection purposes.

    Any help gratefully received.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    2016 primarily
    Posts
    7,141

    Re: macro works in excel 2019 but not in 2010 this gives type mismatch error 13

    That would suggest that whatever is in the cell cannot be interpreted as a date using your regional settings. Perhaps the cell uses a function that doesn't exist in 2010?
    Rory

  3. #3
    Registered User
    Join Date
    01-16-2016
    Location
    NW England
    MS-Off Ver
    2010
    Posts
    16

    Re: macro works in excel 2019 but not in 2010 this gives type mismatch error 13

    Hi Rory

    Many thanks for responding so quickly.

    I will review the regional settings and cross-check the cells accordingly.

    I thought I had set up Data Validation to prevent errors but I'll revisit that area also when I'm next at work.

+ 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. VBA Run time error 13 type mismatch in Excel 2010 with Datavalidation & VBA
    By Maatgie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2017, 12:45 AM
  2. Type mismatch error for Vba macro
    By alonso1111 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-28-2014, 10:54 PM
  3. type mismatch 13 in excel 2010
    By desonny in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2014, 04:57 AM
  4. Formula works but Run Time Error 13 Type Mismatch in VBA
    By uberathlete in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-29-2013, 10:05 PM
  5. Error 13 type mismatch in excel 2010
    By excelbugs_help in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2013, 05:56 AM
  6. [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
  7. 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

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