我正在使用最初由RBarryYoung提供的以下vba。它很接近,但并不完全存在。
Sub quote()
' get the current selection
Dim rng As Range
Set rng = Selection
If rng Is Nothing Then
MsgBox "Nothing Selected", vbOKOnly, "Cannot Define Local Name"
Exit Sub
End If
' get the current worksheet
Dim wks As Worksheet
Set wks = rng.Worksheet
Sht = ActiveSheet.Name
xps = "!"
' get the name to define
Dim sNam As String
sNam = InputBox("Enter the Name to Define for this Sheet:", "Define Local Name")
If sNam = "" Then Exit Sub
' define a name local to this worksheet
wks.Names.Add sNam, Sht & rng.Address
End Sub
问题是本地“引用”定义格式不正确。应该是这个
='VMware Servers'!$K$45
但我得到的最接近的是:
="'VMware Servers'!$K$45"
正因为如此,价值已经关闭,从而打破了一切。