1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
Option Explicit
Public Sub inversion_colonnes()
Dim tblo_ordre As Variant
Dim ub As Byte
tblo_ordre = Array("J", "H", "U", "A", "B", "O", "C", "F", "G", "I", "D", "E", "N", "K", "L", "M", "P", "Q", "R", "S", "T")
ub = UBound(tblo_ordre)
Dim derlign As Byte
With Worksheets("lawks")
derlign = .Cells(.Rows.Count, 2).End(xlUp).Row
End With
Dim i As Integer, j As Byte
Dim tblo() As Variant
Application.ScreenUpdating = False
For i = 1 To derlign
For j = 1 To ub
ReDim Preserve tblo(1 To j)
'tblo(j) = Worksheets("Données_brutes").Cells(i, Range(tblo_ordre(j) & "1").Column)
With Worksheets("lawks")
tblo(j) = .Cells(i, .Range(tblo_ordre(j) & "1").Column)
End With
''Debug.Print tblo(j)
Next j
With Worksheets("lawks").Range("A" & i)
With .Resize(1, ub)
.Value = tblo
.EntireColumn.AutoFit
End With
'.NumberFormat = "0"
End With
Erase tblo
Next i
End Sub |
Partager