Impossible de creer la macro voulue

Bonjour,

je suis débutante dans l'utilisation des macro et ça se confirme... impossible de créer la macro qui va bien :

dans le fichier joint, l'onglet BASE correspond au fichier qu'on m'envoie et que je voudrais transformer tel que l'onglet RESULTAT...

le problème est qu'une ligne dans l'onglet BASE doit se transformer en 3lignes dans l'onglet RESULTAT.

La macro fonctionne pour une ligne mais pas avec la boucle...

merci pour votre aide.

Delphine

9test-macro.xlsx (11.09 Ko)

Bonsoir Delphine,

toujours au boulot à cette heure?

Voici ton fichier. Un petit bouton rouge à cliquer en BASE...

Private Sub cmdGO_Click()
'
Dim tTab
'
iRow = Range("A" & Rows.Count).End(xlUp).Row
tTab = Range("A1:F" & iRow)
'
With Worksheets("RESULTAT")
    iRow = .Range("A" & Rows.Count).End(xlUp).Row
    If iRow > 2 Then .Range("A3:E" & iRow).ClearContents
    .Range("A2:E" & iRow).Borders.LineStyle = xlLineStyleNone
    '
    iLig = 2
    For x = 2 To UBound(tTab, 1)
        For y = 3 To 5
            iLig = iLig + 1
            .Cells(iLig, 1) = tTab(x, 1)
            .Cells(iLig, 2) = tTab(x, 2)
            .Cells(iLig, 3) = tTab(x, 6)
            .Cells(iLig, 4) = tTab(1, y)
            .Cells(iLig, 5) = tTab(x, y)
        Next
    Next
    '
    iRow = .Range("A" & Rows.Count).End(xlUp).Row
    .Range("A2:E" & iRow).Borders.LineStyle = 1
    .Activate
End With
'
End Sub

Bon travail!

A+

14train.xlsm (23.06 Ko)

C'est top

merci beaucoup...

j'espère que j'arriverai à l'adapter à mes autres fichiers.

En tout cas , encore une fois merci beaucoup

Rechercher des sujets similaires à "impossible creer macro voulue"