Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Excel 互操作库中,是否有确定给定Range对象是否包含在另一个Range对象中的功能?
Range
比较 each 的行和列索引对我来说很简单Range,但是当您想要比较可能位于不同工作表上的两个范围时,事情会变得更加复杂。
Application.Intersect将完成这项工作。
Application.Intersect
它会给你一个范围,它是两个范围 A 和 B 的交集
如果范围 A 包含在范围 B 中,则结果将具有与 A 相同的宽度和高度。
如果范围根本不相交,结果将为 null / Nothing。