Do you use Range names in Excel? Today I have updated my 100% free Excel Name Manager add-in with two new features:
– Edit the name’s comment
– Filter Lambda names
Here’s a screen-shot:
Jan Karel Pieterse
I said I should do it. So I did it.
I created four workbook-level defined names in a blank workbook. Then I saved that workbook as Book.xlt in
C:\Program Files (x86)\Microsoft Office 2010\Office14\XLSTART\. Now every new workbook will have those four named constants for use in formulas.
I put the chances that I will remember that they’re there/use them at about 20%.
I got a email from a client asking for help because Excel was “destroying,” to use his terminology, his 2003 workbook after conversion to the 2007 format. And, after analyzing the kind of change Excel made, I had to agree.
The following in 2003
becomes, in 2013 (and in 2010),
The basic problem is that names that are legitimate names in Excel 2003 may become unacceptable in 2007 (or later). But, a more devastating problem is with a formula using a name with a dot in it. Even though it is completely legitimate, Excel changes the dot to a colon. This causes the formula =SW1.SW2 to become =SW1:SW2. Don’t ask me why. It just does. The result is the formula is all wrong and destroys the integrity of the workbook.
It appears that the cause may be Excel trying to help manage the transition of a XLS workbook into the newer format. In 2007, Microsoft increased the number of columns from 256 to 16,384. Consequently, the reference to last column went from IV to XFD. So, a name such as SW1, completely OK in 2003, became unacceptable in 2007. On converting a XLS file to a XLSX file, Excel will convert such names by adding an underscore at the start of the name. But, it seems to go beyond that, converting formula references to certain names with dots in them to a colon. This happens if both the tokens to the left and to the right of the dot could be legitimate cell references. So, Excel converts the formula =XFD1.XFD2 to =XFD1:XFD2 but it will leave =XFD1.XFE2 alone.
To replicate the problem:
The safest way to work around this problem is to add an underscore before every name in the workbook before making the transition to the 2007 format. Obviously, the quickest way to do this would be with a very simple VBA procedure. But, through trial and error I discovered the code will not work in 2003. It runs without any problems but it doesn’t do anything!
So, the correct way to use the code is the following sequence.
Dim aName As Name
For Each aName In ActiveWorkbook.Names
If Left(.Name, 1) <> "_" Then _
.Name = "_" & .Name