I think this does what you want:
Public Sub GetNames()
    Dim n As Integer

    For n = 1 To ActiveWorkbook.Names.Count
        Sheets("Sheet2").Cells(n, 1).Value = ActiveWorkbook.Names(n).Name
    Next
End Sub

On Sun, Nov 9, 2008 at 2:04 PM, <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I have an excel workbook that is working in a similar manner to a
> database in that I write the values for named ranges to a separate
> sheet that contains all of the variables in columns.  In order to
> accomplish this I have a macro that searches a sheet for all of the
> named cells on that sheet and then writes the value to the "database"
> sheet for future reference.
>
> The problem I have encountered is that using Range.Name.Name to access
> the cell name is very slow, so if I am reading values in from the
> database sheet or comparing values to the database sheet it ends up
> taking 15 or 20 seconds to read.
>
> So, does anyone know of a method for determining a cell name that is
> quicker than what is shown below?
>
> Public Sub Test()
> Dim varName As String
>
> On Error Resume Next
> Set rnArea = Range("A1:Z100")
> For Each rnCell In rnArea
>    'Determine the variable name - will cause an error if there is no
> name
>    varName = rnCell.Name.Name
> Next
> End Sub
>
> Thanks in advance.
> Scott
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/excel-macros?hl=en

Visit & Join Our Orkut Community at 
http://www.orkut.com/Community.aspx?cmm=22913620

Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com

To see the Daily Excel Tips, Go to:
http://exceldailytip.blogspot.com
-~----------~----~----~----~------~----~------~--~---

Attachment: GetNames.xls
Description: MS-Excel spreadsheet

Reply via email to