T
tomandrobyn
I've tried using the Nth_Occurence function (below) from the Ozgrid
site. The problem is when I set it up for 1,2,3,4,5 occurences and if
there is only one occurence it shows that one in all 5 cells. Could a
slight change in this code return a blank if looking for a 2nd
occurnace and there is no 2nd?
Thanks in advance,
Tom
Function Nth_Occurrence(range_look As Range, find_it As String, _
occurrence As Long, offset_row As Long, offset_col As Long)
Dim lCount As Long
Dim rFound As Range
Set rFound = range_look.Cells(1, 1)
For lCount = 1 To occurrence
Set rFound = range_look.Find(find_it, rFound, xlValues,
xlWhole)
Next lCount
Nth_Occurrence = rFound.offset(offset_row, offset_col)
End Function
site. The problem is when I set it up for 1,2,3,4,5 occurences and if
there is only one occurence it shows that one in all 5 cells. Could a
slight change in this code return a blank if looking for a 2nd
occurnace and there is no 2nd?
Thanks in advance,
Tom
Function Nth_Occurrence(range_look As Range, find_it As String, _
occurrence As Long, offset_row As Long, offset_col As Long)
Dim lCount As Long
Dim rFound As Range
Set rFound = range_look.Cells(1, 1)
For lCount = 1 To occurrence
Set rFound = range_look.Find(find_it, rFound, xlValues,
xlWhole)
Next lCount
Nth_Occurrence = rFound.offset(offset_row, offset_col)
End Function