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

Worksheet Search – Find Text Coordinates

Searches for a specified text in an Excel.Worksheet and returns its cell coordinates if found.

This function uses Excel’s Find method with case sensitivity enabled and returns the cell position via RowNumber and ColNumber.

VB
    Public Function xlFindTextCoordinates(wsSheet As Excel.Worksheet, 
                                          TextToFind As String,                                           
                                          ByRef RowNumber As Integer, 
                                          ByRef ColNumber As Integer, 
                                          Optional LookAt As Object = xlWhole) As Boolean

        Dim erRange As Excel.Range = wsSheet.Cells.Find(What:=TextToFind, LookIn:=xlValues,
                                        LookAt:=LookAt, SearchOrder:=xlByRows, SearchDirection:=xlNext,
                                        MatchCase:=True, SearchFormat:=False)

        If Not erRange Is Nothing Then
            RowNumber = erRange.Row : ColNumber = erRange.Column
            Return True
        End If

        Return False
    End Function

Posted by ipercube


© 2026 Ipercube Design