gpt4 book ai didi

vba - 如何检测VBA excel是否发现了什么?

转载 作者:行者123 更新时间:2023-12-02 03:00:38 25 4
gpt4 key购买 nike

我在宏中使用它来查找工作表中的内容:

Selection.Find(What:=email, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate

我如何判断它是否找到了某些东西?

最佳答案

Dim rng As Range

Set rng = Selection.Find(What:=email, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)

If Not rng Is Nothing Then 'when rng <> nothing means found something'
rng.Activate
End IF

关于vba - 如何检测VBA excel是否发现了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1589939/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com