I am trying to get a multiple area range made from a line-by-line comparison with a reference value. I am using code including the union method, but for some reason the union does not gather the parts as the rows are found. It simply drops the old row out for the new one, and the row.count is never more than 1.
Thanks for any help!
Here's the code I hope someone can figure this out:
Code:
Function GetRange(LookVals As Range, LookRange As Range) As Range
Dim C As Object
Dim CL As Object
Dim rngSeed As Range
Set rngSeed = LookRange.Rows(1).EntireRow
For Each C In LookRange
For Each CL In LookVals
If C = CL Then
Set rngSeed = Application.Union(rngSeed, C.EntireRow)
Exit For
End If
Next
Next
Set GetRange = LookRange.Rows(1).EntireRow
End Function