Boucle qui réagis bizzarement

Bonjour a tous,
bon je deviens fou avec ce bout de code,

For m = 0 To 11
    If wf.Cells(15 + m, 3).Text <> "" Then
        With worddoc.Tables(1)   
                .Rows.Add
                .Cell(.Columns.Count, 1).range.Text = wf.Cells(15 + m, 3).Text ' presta
                .Cell(.Columns.Count, 2).range.Text = wf.Cells(15 + m, 4).Text ' date
                .Cell(.Columns.Count, 3).range.Text = Format(wf.Cells(15 + m, 5).Text, "#.00 €")
                .Cell(.Columns.Count, 4).range.Text = Replace(wf.Cells(15 + m, 6).Text, ":", "h")
                .Cell(.Columns.Count, 5).range.Text = Format(wf.Cells(15 + m, 7).Text, "#.00 €") 
        End With
    End If
Next m

Le but étant de récupérer un tableau Excel et de l’intégrer dans un tableau Word.
Bizarrement pour les 3 premières lignes ca marche mais ensuite il me récupère que la dernière
donc si y en a 4 il match, mais si y en a 5 ou plus il me récupère que la dernière ligne et je me retrouve avec 4 ligne au lieu de 11 si il y en a 11 dans mon tableau Excel.
par contre il créer bien les 11 ligne dans mon tableau word mais vierge

Ca me parait simple et je me dis y a quelque chose que je vois pas peut être.

Vous voyez une coquille ou peut être que mon code est foireux.

Bonjour,
Sans voir le tableau Excel ?

testtemplate - xxx.xlsm (47,7 Ko)

Un exemple de mon fichier

Re,
Teste en remplaçant par ceci

With worddoc.Tables(1)
    I = 1
      For m = 15 To 25
        If wf.Cells(m, 3) <> "" Then
          .Rows.Add
          .Cell(I, 1).Range.Text = wf.Cells(m, 3).Text  ' presta
          .Cell(I, 2).Range.Text = wf.Cells(m, 4).Text  ' date
          .Cell(I, 3).Range.Text = Format(wf.Cells(m, 5).Text, "#.00 €")  ' taux horaire
          .Cell(I, 4).Range.Text = Replace(wf.Cells(m, 6).Text, ":", "h")  ' durée
          .Cell(I, 5).Range.Text = Format(wf.Cells(m, 7).Text, "#.00 €")  ' stotal
          I = I + 1
        End If
      Next m
  End With

Super merci ! j’aurais pas trouvé XD

Ce sujet a été automatiquement fermé après 30 jours. Aucune réponse n’est permise dorénavant.