Results 1 to 2 of 2
  1. #1
    Join Date
    May 2011
    Posts
    1

    Unanswered: Excel 2003 - 2010 upgrade; help with Macro Error

    I just updated Microsoft Office from 97-2003 to Office 2010, and one of my main control macro's stopped working.

    I've isolated the problem to where I'm trying to name a specific cell range, where I get a "Runtime Error '13': Type Mismatch" error.

    Any help would be much appreciated, as I'm still learning the basics of VB, and actually inherited this spreadsheet from a previous employee (so I don't completely understand what all of the lines actually do).

    Erroring Code:

    ActiveWorkbook.Names.Add Name:="ISOdata", RefersToR1C1:= _
    "=IsoTrain!R3C1:R" & Cells(1, 1).Value + 3 & "C23"

  2. #2
    Join Date
    Sep 2008
    Location
    London, UK
    Posts
    511
    Hi Ben and welcome...

    If you break that code out as follows, what do you see in the immediate window when you run the code?

    Code:
    Dim strRefersTo as String
     
    Debug.Print Cells(1,1).Value
     
    strRefersTo = "=IsoTrain!R3C1:R" & Cells(1, 1).Value + 3 & "C23"
     
    Debug.Print strRefersTo
     
    ActiveWorkbook.Names.Add Name:="ISOdata", RefersToR1C1:= strRefersTo

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •