Ranger un tableau

Bonjour a Tous

J'ai un tableau de plusieurs colonnes et je voulais le ranger autrement (supprimer des colonnes et déplacer d'autres)et pour finir encadrer les cellules du tableau

J'ai essayer d'enregistrer une macro mais cela ne fonctionne que sur un seul tableau et si je veut changer de tableau ( complètement identique) cela ne fonctionne plus.

Je perd un temps fou a chaque fois et c'est vraiment une prise de tète.

J'ai mis un fichier comportant le tableau initial et dans un autre onglet le résultat voulu.

Merci de votre aide et j’espère vous rendre le service un jour .

8test.xlsx (87.49 Ko)

Bonjour KSIKSI1,

Voyez si le fichier joint peut vous aider

=SI(INDIRECT("'tableau initial'!"&ADRESSE(LIGNE();A$1);1)="";"";INDIRECT("'tableau initial'!"&ADRESSE(LIGNE();A$1);1))
4ksiksi1-test.xlsx (79.16 Ko)

Bonjour,

Une proposition.

Ctrl + m pour exécuter la procédure.

A te relire.

Cdlt.

4ksiksi.xlsm (59.65 Ko)
Public Sub Consolidate_data()
Dim wsData As Worksheet, wsFinal As Worksheet
Dim arrCol As Variant, vCol As Variant
Dim LastCol As Integer, iCol As Integer
Dim LastRow As Long
    Set wsData = Worksheets("tableau initial")
    arrCol = Split("8 1 37 2 3 6 10 11 14 15 12 16 17 19 21 24 25 22 26 27 29 31 32 38 39 40")
    Application.DisplayAlerts = False
    On Error Resume Next
    Worksheets("tableau final").Delete
    On Error GoTo 0
    Application.DisplayAlerts = True
    Set wsFinal = Worksheets.Add(after:=Worksheets(Worksheets.Count))
    wsFinal.Name = "tableau final"
    With wsData
        LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
        LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
        For vCol = LBound(arrCol) To UBound(arrCol)
            iCol = iCol + 1
            wsFinal.Cells(1, iCol).Resize(LastRow).Value = .Cells(1, CInt(arrCol(vCol))).Resize(LastRow).Value
        Next vCol
    End With
End Sub

Merci bcp j'ai essayer et ça marche .Parfais.

Bonjour,

Pense à clore e sujet.

cdlt.

Rechercher des sujets similaires à "ranger tableau"