AW: Zahlen aus Text filtern
07.12.2006 00:55:58
Erich
Hallo Ulf,
probiers mal mit
Option Explicit
Sub Test_Zahl_aus_Text()
Dim ZahlDrei As Double, ZahlVier As Double, zz As Long
Columns("B:C").ClearContents
For zz = 1 To Cells(Rows.Count, 1).End(xlUp).Row
ZahlDrei = Zahl_aus_Text(Cells(zz, 1), 3)
Cells(zz, 2) = ZahlDrei
ZahlVier = Zahl_aus_Text(Cells(zz, 1), 4)
Cells(zz, 3) = ZahlVier
Next zz
End Sub
Function Zahl_aus_Text(ByVal strTxt As String, ByVal intLen As Integer)
Dim ii As Integer
For ii = intLen To Len(strTxt)
If IsNumeric(Right(Left(strTxt, ii), intLen)) Then
If (ii = intLen Or Not IsNumeric(Right(Left(strTxt, ii - intLen), 1)) And _
(ii = Len(strTxt) Or Not IsNumeric(Right(Left(strTxt, ii + 1), 1)))) Then
Zahl_aus_Text = Right(Left(strTxt, ii), intLen)
Exit For
End If
End If
Next ii
End Function
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort