Meinst du sowas in der Art?
Public Function SucheNachString()
MsgBox FindFirst("Alter"), vbOKOnly + vbInformation, "Suchergebnis"
End Function
Public Function SucheNachZahl()
MsgBox FindFirst(19), vbOKOnly + vbInformation, "Suchergebnis"
End Function
Public Function FindFirst(FindWhat As Variant) As String
Dim rngAll As Excel.Range
Dim rngFound As Excel.Range
Dim strRow As String
Dim strCol As String
Dim lngCol As Long
Dim CharCode As Long
Set rngAll = Application.ActiveSheet.Cells
Set rngFound = rngAll.Find(FindWhat)
If Not rngFound Is Nothing Then
strRow = CStr(rngFound.Row)
lngCol = rngFound.Column
Do While lngCol > 0
CharCode = lngCol Mod 26
If CharCode = 0 Then
CharCode = 26
End If
strCol = Chr(64 + CharCode) & strCol
lngCol = (lngCol - CharCode) / 26
Loop
FindFirst = "Row:" & vbTab & strRow & vbNewLine & "Column:" & vbTab & strCol
Else
FindFirst = "Sowos gibt's do net!"
End If
End Function
|