开发者

VBA: How do I find a cell containing a substring in a given range?

Say I have a range of data from A1:Y55 containg data like "123 UID"

I a开发者_如何学Cm looking for a unique substring (in this case, the UID) in that range, how do I do this?


You can do this with the following code.

On Error Resume Next

Range("A1:Y55").Find(What:="UID", After:=ActiveCell, LookIn:=xlFormulas, _
    LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False).Activate

The error statement will allow the program to continue if it does not find any matches.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜