GetFirstInstanceInExcel

From scripting
Revision as of 05:56, 22 April 2017 by Nickpisca (talk | contribs) (Created page with " Function GetFirstInstanceInExcel(InputVal As String, ColumnNo As Integer, EndRow As Integer) As Integer Dim LCounter As Integer LCounter = 2 While LCounter <= EndRow...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function GetFirstInstanceInExcel(InputVal As String, ColumnNo As Integer, EndRow As Integer) As Integer
Dim LCounter As Integer
LCounter = 2
While LCounter <= EndRow
    CurCellStr = CStr(CurCells(LCounter, ColumnNo).Value)
    If CurCellStr = InputVal Then
        GetFirstInstanceInExcel = LCounter
        Exit Function
    End If
    LCounter = LCounter + 1
Wend
GetFirstInstanceInExcel = -1
End Function