Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata
Public Function FindStringCellAddr(search As String) As String
Dim rng As Range
Dim cell As Range
    
Set rng = GetUsedRange(ActiveSheet)
search = 10517

FindStart:
Set cell = rng.Find( _
    What:=search, _
    LookIn:=xlValues, _
    LookAt:=xlWhole, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False, _
    SearchFormat:=False _
)

If cell Is Nothing Then
        Debug.Print "Not Found, Formatting Range as 'General' Cell.Type and Re-Trying"
        rng.NumberFormat = "General"
        Dim FailedAndReTrying As Boolean
        If FailedAndReTrying = False Then
         FailedAndReTrying = True
         GoTo FindStart
        End If
Else
    FindStringCellAddr = cell.Address(False, False)
    Debug.Print "Found In " & FindStringCellAddr
   
End If

End Function
  • No labels