excel vba中 Range names操作

2025-03-09 20:01:35
推荐回答(2个)
回答1:

变量Nm 本身就只是一个Names集合中的元素
所以没有Nm.name

For Each Nm In ActiveWorkbook.Names
If Nm Like "*X_Tbl" Then '查找含X_Tbl的名称
OldValue = 0
For Each mycell In Range(Nm)
If (mycell.Column = 21) Then '只能U列起作用
ThisValue = HexToInt(mycell.Value)
If (ThisValue < OldValue) Then
CheckTableXAxis = False
End If
'MsgBox "ThisValue:" & ThisValue & ",OldValue:" & OldValue
OldValue = ThisValue
'MsgBox "Nm.Name:" & Nm
End If
Next mycell
End If
Next Nm

回答2:

应该检查含X_Tbl的名称是否都是有效的范围引用?