Hello,
I found a custom function that works perfectly to return the value of the Nth occurence of a string in a specified range:
Now I would rather be interested in either the complete range of this Nth_occurence or just the row of this Nth_occurence.
The value I could get anyway by just adding the ".value" to the range.
I tried to replace "Nth_Occurrence = rFound.Offset(offset_row, offset_col)" with "Nth_Occurence = rFound.row", but it just gives me 0.
Could somebody please help me how to achieve this?
Thank you
I found a custom function that works perfectly to return the value of the Nth occurence of a string in a specified range:
Code:
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, 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
Now I would rather be interested in either the complete range of this Nth_occurence or just the row of this Nth_occurence.
The value I could get anyway by just adding the ".value" to the range.
I tried to replace "Nth_Occurrence = rFound.Offset(offset_row, offset_col)" with "Nth_Occurence = rFound.row", but it just gives me 0.
Could somebody please help me how to achieve this?
Thank you