Skip to sidebar Skip to content
Ipercube Technical
Jack of all trades, master of none
Date: Time: - Stardate:
Welcome, Log in by clicking  Here!
SS64
MDN
Stack
Code
GitHub
Wiki
Convert
V Studio
  • Home
  • VB Functions
    • Access Functions
    • Assembly Info
    • Color/Image Functions
    • Data Table Functions
    • Email Functions
    • Active Directory Functions
    • LDAP Functions
    • Excel Functions
    • Logging Functions
    • Source Code Retrieval
    • String Functions
    • Sql Functions
    • Object Utilities Functions
    • System and Utilities
    • Utility Forms
  • VB Classes
    • Environment Variables Helper
  • ABAP
    • ABAP Reports
    • ABAP HTTP Functions
Ipercube Technical
  • Home
  • VB Functions
    • Access Functions
    • Assembly Info
    • Color/Image Functions
    • Data Table Functions
    • Email Functions
    • Active Directory Functions
    • LDAP Functions
    • Excel Functions
    • Logging Functions
    • Source Code Retrieval
    • String Functions
    • Sql Functions
    • Object Utilities Functions
    • System and Utilities
    • Utility Forms
  • VB Classes
    • Environment Variables Helper
  • ABAP
    • ABAP Reports
    • ABAP HTTP Functions

Row Scanning – Return First Not Empty Cell Value (Left to Right)

Scans a row in an Excel.Worksheet from left to right and returns the value of the first non-empty cell.

The function begins scanning from the specified column in the given row and continues to the end of the worksheet columns.

VB
    Public Function xlL2R_ReturnFirstNotEmptyCellValue(wsSheet As Excel.Worksheet,
                                                       ByRef RowNumber As Integer, 
                                                       ByRef ColNumber As Integer) As String

        For iColIndex As Integer = ColNumber To wsSheet.Columns.Count
            If CStr(wsSheet.Cells(RowNumber, iColIndex).Value) <> "" Then
                ColNumber = iColIndex
                Return CStr(wsSheet.Cells(RowNumber, iColIndex).Value)
            End If
        Next

        Return String.Empty
    End Function

Posted by ipercube


© 2026 Ipercube Design