VBA语法,用于正确输出
我正在使用由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"
正因为如此,价值是closures的,打破了一切。