I am advised that a UDF can be made more efficient by passing the "range of interest" to the UDF instead of making it volatile. Refer thread:
http://www.excelforum.com/excel-prog...ml#post2319512
However I do not know how to pass the range of interest to the UDF. Can someone please help?
The UDF:
Function pFindRowPos(sText As Variant, _
Optional SearchDirection As XlSearchDirection = xlNext, _
Optional SearchOrder As XlSearchOrder = xlByRows) As Long
Application.Volatile
Dim lResult As Long, oRg As Range
With Worksheets("PDFDump").Cells
Set oRg = .Find(What:=sText, LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=SearchOrder, _
SearchDirection:=SearchDirection, _
MatchCase:=False, SearchFormat:=False)
If Not oRg Is Nothing Then lResult = oRg.Row
pFindRowPos = lResult
Set oRg = Nothing
End With
End Function
' Input param: Text we want to look for
' Optional input params:
' Search direction (forward, backward),
' Search order (in row or column)
' Output: row position of the text being searched
'Asha: Source http://excelvbamacro.com/how-to-find-row-position-of-a-particular-text/
Many thanks in advance
Asha
Bookmarks