Gruppe
Ereignis
Problem
Wie kann ich Eingaben in Zelle A1 in Gruppen von jeweils fünf Zeichen aufteilen und diese in Zellen eintragen lassen?
ClassModule: Tabelle1
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iCounter As Integer, iMax As Integer, iRow As Integer
Dim sTxt As String
If Target.Column <> 1 Then Exit Sub
If IsEmpty(Target) Then Exit Sub
Application.EnableEvents = False
On Error GoTo ERRORHANDLER
iMax = 5
sTxt = Target.Text
For iCounter = 1 To Len(sTxt)
If Len(sTxt) > 5 Then
Target.Offset(iRow, 0) = Left(sTxt, 5)
iRow = iRow + 1
sTxt = Right(sTxt, Len(sTxt) - 5)
End If
Next iCounter
Target.Offset(iRow, 0) = sTxt
ERRORHANDLER:
Application.EnableEvents = True
End Sub