I have used the Find_Range
function from OzGrid which returns a Range object with the found items. It have used it successfully. I know that looping through each item of the resultant Range allows for updates/modifications to the individual cells. The Count property shows the right value.
There is no Value
property and the Value2
property only shows the first item found.
My question is - What is the property in the result of Find_Range
( which is a range of non-contiguous cells) that lists all the found items?
Edit:
A bit more clarity - Generally a Range object such as the ffg can provide a Variant array of all the selected items in a Range
Dim selRange as Range
Dim vals as Variant
Set selRange = Range("A1:B10")
vals = selRange.Value // 2D array with all values from the range
However,
Set selRange = Range("A1,A2,B10") // this is similar to the result of the Find-Range Function
vals = selRange.Value // will only provide the value of A1 and not all three
Function Find_Range(Find_Item As Variant, _
Search_Range As Range, _
Optional LookIn As Variant, _
Optional LookAt As Variant, _
Optional MatchCase As Boolean) As Range
Dim c As Range
If IsMissing(LookIn) Then LookIn = xlValues 'xlFormulas
If IsMissing(LookAt) Then LookAt = xlPart 'xlWhole
If IsMissing(MatchCase) Then MatchCase = False
With Search_Range
Set c = .Find( _
What:=Find_Item, _
LookIn:=LookIn, _
LookAt:=LookAt, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=MatchCase, _
SearchFormat:=False)
If Not c Is Nothing Then
Set Find_Range = c
firstAddress = c.Address
Do
Set Find_Range = Union(Find_Range, c)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Function