none
Excel 2010 Macro RRS feed

  • Question

  • I recently switched to Office 2013; I tried running  a report using the macro that was created in an earlier version of Excel and it failed. The macro worked fine in Excel 2010 but now fails with I run it.  I've attached a screenshot of the error: 

    I got a Run-time error '13':  Type mismatch

    This is where it happens in the macro:

    For i = 1 To 12000

     If ActiveCell.Offset (0, 1) <> " " Then (Macro failed here)

     If Instr(ActiveCell.Offset (0,  1), "IEM") > 0 Then

      If Left (FindSegment (ActiveCell.Offset (0, 4)), 2) = "US" Then

        ActiveCell = "PMD-IEM"

        ActiveCEll.Interior.Color = vbYellow

           End If

       End If

    End If

    ActiveCell.Offset (1).Select

    If ActiveCell.FormulaR1C1 = "" Then Exit for

    Next i

    Can you provide insight as to why the macro no longer works in 2013?


    Elizabeth

    Wednesday, October 28, 2015 8:18 PM

Answers

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Excel, I'll move your question to the MSDN forum for Excel
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Regards,

    Emi Zhang
    TechNet Community Support


    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact tnmff@microsoft.com.
    • Marked as answer by Lizz45ie Thursday, October 29, 2015 4:59 PM
    Thursday, October 29, 2015 3:07 AM

All replies

  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Excel, I'll move your question to the MSDN forum for Excel
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Regards,

    Emi Zhang
    TechNet Community Support


    Please mark the reply as an answer if you find it is helpful.

    If you have feedback for TechNet Support, contact tnmff@microsoft.com.
    • Marked as answer by Lizz45ie Thursday, October 29, 2015 4:59 PM
    Thursday, October 29, 2015 3:07 AM
  • >>>I got a Run-time error '13':  Type mismatch

    According to your description, I have test this line code("If ActiveCell.Offset (0, 1) <> " " Then") in Excel 2013, but I get no errors.

    Visual Basic is able to convert and coerce many values to accomplish data type assignments that weren't possible in earlier versions. However, this error can still occur and has the following causes.

    So You could refer to below link to make sure that there are no these causes.

    https://msdn.microsoft.com/en-us/library/aa264979%28v=vs.60%29.aspx?f=255&MSPPError=-2147217396

    Otherwise could you provide more information(screenshot, sample code etc.)? That will help us reproduce and resolve your issue.

    Friday, October 30, 2015 8:40 AM