VBA测试,如果单元格在一个范围内 [英] VBA test if cell is in a range

查看:188
本文介绍了VBA测试,如果单元格在一个范围内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想测试一个给定单元格是否在Excel VBA中的给定范围内。这是最好的方法?

I want to test if a given cell is within a given range in Excel VBA. What is the best way to do this?

推荐答案

从帮助中:

Set isect = Application.Intersect(Range("rg1"), Range("rg2"))
If isect Is Nothing Then
    MsgBox "Ranges do not intersect"
Else
    isect.Select
End If

这篇关于VBA测试,如果单元格在一个范围内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆