Je reçois une erreur de compilation: expression attendue. Aucune ligne n'est mise en surbrillance XD
Sub name() Dim arr() As Ssortingng Dim lastRow As Long c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = arr(e) c = c + 1 Next Set arr = Empty Next End With End Sub
Comme @gtwebb a déclaré que le nom était le problème principal.
Il y a eu une autre chose mineure que j'ai trouvée: le debugging:
Sub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
Sous-Nom2 ()Sub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
Dim e As VariantSub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
Dim lastRow As LongSub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
Dim c As IntegerSub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
Dim arr () As SsortingngSub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
c = 2Sub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
Avec ActiveSheetSub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
lastRow = .Cells (.Rows.Count, "A"). End (xlUp) .RowSub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
Pour i = 1 À lastRowSub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
c = 2Sub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
arr = Split (.Cells (i, 1), "")Sub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
Pour chaque e In arrSub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
.Cell (i, c) .Value = eSub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub
c = c + 1Sub name2() Dim e As Variant Dim lastRow As Long Dim c As Integer Dim arr() As Ssortingng c = 2 With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To lastRow c = 2 arr = Split(.Cells(i, 1), " ") For Each e In arr .Cells(i, c).Value = e c = c + 1 Next Next End With End Sub