Hi to all,
Some help please.
I normally use a loop with "Find" method to search for some word and store in an Array all its positions within a range. Something like this:
Sub Find()
Dim MyArray(), CurrentValueAddress As String, b As Interior, Count As Integer
CurrentValueAddress = "A1" : Count = 5
ReDim MyArray(1 To Count)
For b = 1 To Count
CurrentValueAddress = Columns("A:C").Find(What:= _
"String", After:=Range(CurrentValueAddress), LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False).Address
MyArray(b) = CurrentValueAddress
Next
End Sub
When I record a macro--> Ctrl+F-->entering a "string" to search and--> clicking "Search all" Excel finds all ocurrences and respective positions in a range.
I was wondering if somebody knows how to do with VBA a "Search all" and store the result in an Array directly avoiding use a loop for this.
I remember I saw time ago in some place that somebody do something similar using collections or areas, I'm not sure, but it looks that stores values in Array without loop.
Any help would be very appreciated.
Regards
Bookmarks