如何更改命名范围 [英] How to change Named Range Scope
问题描述
当通过名称管理器创建命名范围时,我可以选择指定Workbook或 [工作表名称]
范围。但是如果要更改范围,则下拉列表将变灰。有没有办法,在名称管理器中,还是更喜欢VBA来更改现有命名范围的范围?
When I create a named range through the Name Manager, I'm given the option of specifying Workbook or [worksheet name]
scope. But if then want to change scope, the drop-down is grayed out. Is there a way, in either Name Manager or, preferablly, VBA to change the scope of an existing named range?
例如:
-
testName
指'sheet1'!A1:B2
与范围工作簿。如何更改为 -
testName
指的是'sheet1'!A1:B2
with'sheet1'scope?
testName
refers to'sheet1'!A1:B2
with scope Workbook. How would I change that totestName
refers to'sheet1'!A1:B2
with 'sheet1' scope?
推荐答案
您可以下载免费的名称管理器由我自己和Jan Karel Pieterse从
开发 http://www.decisionmodels.com/downloads.htm
这将启用Excel 2007名称管理器无法处理的许多名称操作,包括更改名称范围。
You can download the free Name Manager addin developed by myself and Jan Karel Pieterse from http://www.decisionmodels.com/downloads.htm This enables many name operations that the Excel 2007 Name manager cannot handle, including changing scope of names.
在VBA中:
Sub TestName()
Application.Calculation = xlManual
Names("TestName").Delete
Range("Sheet1!$A$1:$B$2").Name = "Sheet1!TestName"
Application.Calculation = xlAutomatic
End Sub
这篇关于如何更改命名范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!