DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Excel Vba Find Text In All Cells And Return Row Number
// description of your code here
Same as Control+F
Public Function FindRowPos(sText As Variant, _
Optional SearchDirection As XlSearchDirection = xlNext, _
Optional SearchOrder As XlSearchOrder = xlByRows) As Long
Dim lResult As Long, oRg As Range
Set oRg = Cells.Find(What:=sText, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=SearchOrder, _
SearchDirection:=SearchDirection, _
MatchCase:=False, SearchFormat:=False)
If Not oRg Is Nothing Then lResult = oRg.Row
FindRowPos = lResult
Set oRg = Nothing
End Function






Comments
Scott Mcscott replied on Tue, 2012/09/25 - 12:43am
Alessandro Del ... replied on Thu, 2011/08/11 - 3:14am