Hallo Chantalle,
dieser Code sollte das können:
Public Sub ZeilenZuSpalten()
Dim rgz As Range
Dim sh As Worksheet
Dim idx As Integer, sidx As Integer, ins As Integer
idx = 1
Set sh = ActiveSheet
While idx <= Range("A1").End(xlDown).Row
Set rgz = Range(Cells(idx, 1), Cells(idx, Range("A" & idx).End(xlToRight).Column))
If IsNumeric(rgz.Cells(1).Value) Then
ins = rgz.Columns.Count - 2
sh.Rows(idx + 1 & ":" & idx + ins).Select
Selection.Insert
For sidx = 3 To rgz.Columns.Count
rgz.Cells(sidx).Select
Selection.Cut Destination:=Range("B" & idx + sidx - 2)
Range("A" & idx + sidx - 2).Value = rgz.Cells(1).Value
Next sidx
idx = idx + ins
Else
rgz.Cells(2).Value = "Route"
rgz.Cells(3).Value = ""
rgz.Cells(4).Value = ""
End If
idx = idx + 1
Wend
End Sub
Grüße Lutz
|