How can I change a Name scope from local to Global?

H

Henry

How can I change a Name scope from local to Global?
I designed a worksheet and duplicated it, along with the Names. I have
edited the names but now those are scoped for that worksheet only. Name
Manager does not allow me to change the scope.
 
D

Dave Peterson

Since you can only have one global name with a particular name, you'll have to
create a new name, then delete the old local name.
 
H

Henry

Thanks Dave, I understand that but I edited the name what I would meant is
that I did change it and would like the option to then change the scope but
Excel does not allow that to be done.
 
D

Dave Peterson

When you write Name Manager, is that the one built into xl2007?

I don't use xl2007 enough to know about it.

But Jan Karel Pieterse's (with Charles Williams and Matthew Henson) Name Manager
does have the ability to globalize and localize names.

You can find it at:
NameManager.Zip from http://www.oaltd.co.uk/mvp
 
H

Henry

Yes, it is the one with xl2007.. you would think that MS has the foresight to
take some of the ideas from their developers or buy one that already exists.
But currently 2007 does not give you that functionality. Thanks anyway.
 
D

Dave Peterson

You may want to try that utility.
Yes, it is the one with xl2007.. you would think that MS has the foresight to
take some of the ideas from their developers or buy one that already exists.
But currently 2007 does not give you that functionality. Thanks anyway.
 
J

Jon Furie

I currently have a named range on one worksheet that i can access via just the named range (i.e. range("namedrange")) through one userform but not through another. The second userform required a sheet name before every namedrange reference in my code.

Any thoughts on why one form is behaving differently than the other? Both forms are accessed from the same sheet (albeit different than the location of the namedrange).

thanks,
Jon



Dave Peterson wrote:

Since you can only have one global name with a particular name, you'll have
23-Sep-08

Since you can only have one global name with a particular name, you will have t
create a new name, then delete the old local name

Henry wrote

-

Dave Peterson

Previous Posts In This Thread:

How can I change a Name scope from local to Global?
How can I change a Name scope from local to Global
I designed a worksheet and duplicated it, along with the Names. I have
edited the names but now those are scoped for that worksheet only. Name
Manager does not allow me to change the scope.

Since you can only have one global name with a particular name, you'll have
Since you can only have one global name with a particular name, you will have t
create a new name, then delete the old local name

Henry wrote

-

Dave Peterson


Submitted via EggHeadCafe - Software Developer Portal of Choice
WPF Report Engine, Part 2
http://www.eggheadcafe.com/tutorial...c9-cf3a9ee210a7/wpf-report-engine-part-2.aspx
 
D

Dave Peterson

Try this manually...

Open your workbook and go to any of the sheets that doesn't have that name.
Then use the name dropdown to select that named range.

Notice that you'll go to the range that is a global/workbook level name.

If you go to the sheet that has the local/worksheet level name and do the same
thing, then you'll get the range on the same sheet.

So my general rule is to qualify the named range with the worksheet. An
ambiguity will be lost.

worksheets("Sheet1").range("NamedRange")
or
worksheets("Sheet2").range("NamedRange")

will refer to the range on the respective sheets--no matter what type of name
(global or local) the name actually is.
 
Joined
Jun 25, 2010
Messages
1
Reaction score
0
Henry said:
How can I change a Name scope from local to Global?
I designed a worksheet and duplicated it, along with the Names. I have
edited the names but now those are scoped for that worksheet only. Name
Manager does not allow me to change the scope.

Do it in VBA like this


Public Sub ChangeScope()
Dim theName As Name
Dim refersTo As String
Dim namesName As String
Dim theWorksheet As Worksheet
For Each theWorksheet In ThisWorkbook.Worksheets
For Each theName In theWorksheet.Names
namesName = theName.Name
If InStr(namesName, "!") > 0 Then
namesName = Mid(namesName, InStr(namesName, "!") + 1)
End If
refersTo = theName.refersTo
theName.Delete
ThisWorkbook.Names.Add namesName, refersTo
Next
Next
End Sub



Code works for me but is not guaranteed so check it for yourself. Do not use it on any live document without first testing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top