Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Maximum Named Ranges in excel

Hello all,

I am using the Named ranges in excel to store metadata about each cell
in excel that can persist with the excel file. So 1 cell = 1 Named
Range.Advantage of using this approach is excel automatically updates
the name references, even if we cut-and paste cells.
As per this link(http://office.microsoft.com/en-us/ex...992911033.aspx
), the amount of named ranges is limited only by
the amount of available memory.
I wrote a small macro that adds names to each cell in excel, considering an
average data of 10000 rows into 10 columns.
Like this: <short version, long version at the end
Sub addNames()

Dim objRange As Range
Dim actSheet As Excel.Worksheet
For r = 1 To 10000
For c = 1 To 10
Set actSheet = Excel.ActiveSheet
Set objRange = actSheet.Cells(r, c)
Set nm = ActiveWorkbook.Names.Add("NMR" & r & "C" & c,
objRange)
Next
Next

End Sub

After 65472 cells, excel does not allow me to add more than the
specified amount of names. This is regardless of whatever RAM,
whatever amount of memory is on user's machine.
My question is:
a. Is there a limit on number of names(named ranges) we can add to
excel?
b. Is there some other property that is attached to a cell in excel
that can serve as a metadata holder, and will persist across sessions.
I tried with ID property, but it does not persist across excel session.


See long version of the code (below) with Debug.Print statements:

Sub addNames()
On Error GoTo ERR_MSG

Dim r As Long
Dim c As Long
Dim iCnt As Long

Dim objRange As Range
Dim actSheet As Excel.Worksheet
For r = 1 To 10000
For c = 1 To 10
Set actSheet = Excel.ActiveSheet
Set objRange = actSheet.Cells(r, c)
Set nm = ActiveWorkbook.Names.Add("NMR" & r & "C" & c, objRange)
If r 6500 Then
Debug.Print i
End If
i = i + 1
Next

If r Mod 500 = 0 Then
Debug.Print r
End If
DoEvents
Next
Exit Sub
ERR_MSG:
MsgBox Err.Number & ": " & Err.Description
Exit Sub
End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Maximum Named Ranges in Excel? Sarang Bapat[_2_] Excel Programming 0 January 11th 10 12:37 PM
Maximum number of named ranges? JNW Excel Programming 14 December 18th 08 12:07 PM
Named ranges and pasting formulas with named references Dude3966 Excel Programming 2 October 8th 08 04:15 PM
Named ranges scope / workbook/worksheet level named ranges- changeswith variable use... christian_spaceman Excel Programming 3 December 24th 07 01:15 PM
Copy data in named ranges to a newer version of the same template to identical ranges handstand Excel Programming 0 August 21st 06 03:51 PM


All times are GMT +1. The time now is 11:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"