AW: Z?hlen
24.07.2004 13:42:27
Nepumuk
normalerweise werden Beitr?ge, die so v?llig ohne "Hallo" und "Bitte" auskommen nur gegen Bezahlung beantwortet. Ich hoffe f?r dich, dass du dir das auch noch angew?hnst.
Folgender Code pr?ft die Spalte A:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim intindex As Integer, myrange As Range
If Target.Column = 1 And Target.Count = 1 Then
If Left$(Target, 4) = "5220" And Len(Target) = 6 Then
Application.EnableEvents = False
Target = UCase$(Target)
Application.EnableEvents = True
For intindex = 1 To 9999
Set myrange = Columns(1).Find(What:=Target & " " & Format(intindex, "00000"), LookAt:=xlWhole)
If myrange Is Nothing Then
Application.EnableEvents = False
Target = Target & " " & Format(intindex, "00000")
Application.EnableEvents = True
Exit For
End If
Next
If intindex = 10000 Then MsgBox "Alle Indizes für " & Target & " sind vergeben.", 16, "Warnung"
End If
End If
End Sub
Gru?
Nepumuk