If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Excel 2003 - 2010 upgrade; help with Macro Error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-20-11, 10:41
Ben.Hutt Ben.Hutt is offline
Registered User
 
Join Date: May 2011
Posts: 1
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"
Reply With Quote
  #2 (permalink)  
Old 05-20-11, 17:19
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
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
__________________
Colin

RAD Excel Blog

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
Reply

Tags
help needed, microsoft excel help, visual basic help

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On