Matrice VBA

Résolu/Fermé
memez - 10 mars 2008 à 12:07
Fxbrg Messages postés 711 Date d'inscription samedi 17 mars 2007 Statut Membre Dernière intervention 16 novembre 2013 - 10 mars 2008 à 15:43
Salut le forum,

voila mon problème, je voudrai réaliser une boucle sous VBA mais il me dit que l'expression de ma matrice est incorrecte.

Sub extrapolation()
Dim n As Integer, p As Integer, i As Integer
Application.ScreenUpdating = False
poteau = 0
Do
poteau = poteau + 1
Range("P1:Z" & Worksheets("feuil1").Cells(7, 2).Value + 1).Clear
Range("AC1:AN" & Worksheets("feuil1").Cells(7, 2).Value * 2).Clear
Range("B & (3 * poteau + 4):M" & (3 * poteau + 5)).Copy
Range("AC" & (2 * poteau - 1)).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range("AC & 2 * poteau - 1:Z" & 2 * p).Select
Selection.Sort Key1:=Range("AC & 2 * poteau - 1: AP" & 2 * poteau - 1), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Loop Until poteau = Worksheets("feuil1").Cells(7, 2).Value
End Sub

apparement, ce qui pose probleme c'est l'expression de ma matricee: Range("B & (3 * poteau + 4):M" & (3 * poteau + 5))

merci de me répondre

2 réponses

Fxbrg Messages postés 711 Date d'inscription samedi 17 mars 2007 Statut Membre Dernière intervention 16 novembre 2013 198
10 mars 2008 à 12:29
Salut,

Remplace la ligne qui coince par celle-ci :
Range("B" & (3 * poteau + 4) & ":M" & (3 * poteau + 5)).Copy

Par contre après ça coince 3 lignes en dessous, il manque l'initialisation de p, du coup 2*p=0...

:-)
0
à "" près
lol

merci
0
Fxbrg Messages postés 711 Date d'inscription samedi 17 mars 2007 Statut Membre Dernière intervention 16 novembre 2013 198
10 mars 2008 à 15:43
"", ça se prononce "ptichouïa", non? lol
0