par , 08/11/2016 à 21h29 (1573 Affichages)
Bonjour,
discussion initiale : http://www.developpez.net/forums/d16...trows-tableau/
Via un array unidimensionnel (hard codé pour l'exemple), on redimensionne l'unique tableau de la feuille active et on injecte les éléments en bas, sur la première colonne du Tableau
1 2 3 4 5 6 7 8
| Option Base 1
Sub toto()
Dim Tableau: Tableau = Array("toto", "titi", "tata")
With ActiveSheet.ListObjects(1)
.Resize .Range.Resize(.Range.Rows.Count + UBound(Tableau), .Range.Columns.Count)
.Range.Cells(.Range.Rows.Count - UBound(Tableau) + 1, 1).Resize(UBound(Tableau), 1).Value = Application.Transpose(Tableau)
End With
End Sub |
Application fun : dupliquer les éléments de la colonne
1 2 3 4 5 6 7 8
| Sub toto()
Dim Tableau
With ActiveSheet.ListObjects(1)
Tableau = Application.Transpose(.DataBodyRange.Value)
.Resize .Range.Resize(.Range.Rows.Count + UBound(Tableau), .Range.Columns.Count)
.Range.Cells(.Range.Rows.Count - UBound(Tableau) + 1, 1).Resize(UBound(Tableau), 1).Value = Application.Transpose(Tableau)
End With
End Sub |
Bonne adaptation, le passage en à un tableau de dimension 2 n'est pas compliqué