View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Named range longer than 255 chars

Hi Doug,

If you define a name manually, or in code with an address, the maximum
string length is theoretically 255, in practice maybe a bit less.

So, what's the best way to create a named range that's longer than 255
characters? Will the range continue to include all the cells? It seems

to.

Define in code as a range the way you have already successfully done. There
is a maximum limit to the number of non-contiguous areas. It varies
depending on combination of single/multicell areas, if exceeded will raise
an error for which you can trap. However there is no limit to the overall
address length. Also, as you have noticed, the named range will indeed
continue to work the same way as any other named range.

If you have defined such a range, there is no way to manually edit the
address if it's over 255. A workaround both for creating and editing is to
temporarily rename the sheetname to something short, but still subject to
the overall 255.

For such ranges, indeed anything to do with names, the NameManager addin by
Jan Karel Pieterse and colleagues is a must have:
http://www.jkp-ads.com/Download.htm

FWIW, I work with very large multiarea named ranges, with address strings
that way exceed 255, and find them very useful for certain purposes.

Regards,
Peter T

"Doug Glancy" wrote in message
...
I don't seem to be able to Google a helpful answer on this, although I'm
sure it's been discussed a bunch. If I try to define a name in the Insert
Name dialog, it clears the "refers to" box after (I'm guessing) 255
characters and starts over. But if I define the name through code, the
range contains all the cells in the code even though they don't all show

in
the Insert Name "refers to" box.

So, what's the best way to create a named range that's longer than 255
characters? Will the range continue to include all the cells? It seems

to.

Thanks,

Doug Glancy