Home

Consulting

Excel VBA

Legal

Links

Contact

About Us

Find Row With Specified Value In Speicified Column

'********************************************************************
'  http://www.KravatzInc.com    1-866-XLS-PROG
'
'  This code is copyrighted by Kravatz, Inc. (c) 2007 All Rights Reserved.
'  You may use this code as long as this message appears
'  There is no warranty made to the fitness or suitablilty of this code
'  and by using it you hold Kravatz, Inc. harmless for any damages
'  that may result from its use.  This code is supplied as is.
'  
'********************************************************************
Function FindDataRow(SearchValue, c As Long, Optional bWarnDev As Boolean) As Long
Dim r As Long, curRow As Long

r = FindLastRow(c)
curRow = 0
For curRow = 1 To r Step 1
   
    If IsError(Cells(curRow, c)) Then
        GoTo next_for
    End If
    
    If Trim(Cells(curRow, c)) Like Trim(SearchValue) Then
        FindDataRow = curRow
        Cells(curRow, c).Select
        Exit Function
    End If
    
next_for:
    
Next
FindDataRow = 0


End Function