Column Scanning – Return First Empty Cell Row (Top to Bottom)
Scans a column in an Excel.Worksheet from top to bottom and returns the row index of the first empty cell.
The function starts scanning from the first row and stops at the first cell that is Null or an empty string.
VB
Public Function xlT2B_ReturnFirstEmptyCellRow(wsSheet As Excel.Worksheet,
ColNumber As Integer) As Integer
For iRowIndex As Integer = 1 To wsSheet.Rows.Count
If String.IsNullOrEmpty(wsSheet.Cells(iRowIndex, ColNumber).Value) Then Return iRowIndex
Next
Return 0
End Function