Hi experts,
I have one of the “Find n occurrence” UDF long time ago (see below), this function will find the position of the n occurrence of a number from a range then offset it. This work fine but trouble when the range that it looks for doesn't count the cell with different format then return error, you can find it very easy when you open my attachment. Can you help me tweak this UDF a bit so it can neglect the format. Thank you so much for help.
Note: I cannot attach the file but you can try this by add this function to your book
-----------
Function FINDNTHOCC(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
FINDNTHOCC = rFound.Offset(offset_row, offset_col)
End Function
I have one of the “Find n occurrence” UDF long time ago (see below), this function will find the position of the n occurrence of a number from a range then offset it. This work fine but trouble when the range that it looks for doesn't count the cell with different format then return error, you can find it very easy when you open my attachment. Can you help me tweak this UDF a bit so it can neglect the format. Thank you so much for help.
Note: I cannot attach the file but you can try this by add this function to your book
-----------
Function FINDNTHOCC(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
FINDNTHOCC = rFound.Offset(offset_row, offset_col)
End Function