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.
精彩评论