我正在使用 C# 创建 Excel 加载项。
如何检查选定的(或代码中范围表示的单元格)是否在特定范围内。例如如何检查单元格 $P$5 是否在 $A$1:$Z$10 范围内
Use Application.Intersect
,像这样(在VBA中)
Sub TestIntersect()
Dim MyRange As Range
Dim TestRange As Range
Set TestRange = [$A$1:$Z$10]
Set MyRange = [P5]
If Not Application.Intersect(MyRange, TestRange) Is Nothing Then
Debug.Print "the ranges intersect"
End If
End Sub
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)