高手们,帮看一下下面这段代码有什么问题?出现400错误!多谢~
For Each Nm In ActiveWorkbook.Names
If Nm.Name 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.Name
End If
Next mycell
End If
Next Nm
excel vba中 Range names操作
答案:2 悬赏:20 手机版
解决时间 2021-03-08 16:07
- 提问者网友:那叫心脏的地方装的都是你
- 2021-03-07 16:34
最佳答案
- 五星知识达人网友:愁杀梦里人
- 2021-03-07 16:49
变量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
所以没有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
全部回答
- 1楼网友:荒野風
- 2021-03-07 17:10
你好!
应该检查含X_Tbl的名称是否都是有效的范围引用?
仅代表个人观点,不喜勿喷,谢谢。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯