redim tableau a 2 dimensions
bonjour j'ai ce code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
Dim tableau() As Variant
nomcherche = "!Px F"
Set result1 = ActiveSheet.UsedRange.Rows(2).Find(What:="!F", LookIn:=xlValues, LookAt:=xlWhole)
Set colprix = Range(result1.Offset(1, 0).Address, result1.Offset(ActiveSheet.UsedRange.Rows.Count, 0))
Set zone = Range("a2", Range("a2").Offset(0, ActiveSheet.UsedRange.Columns.Count))
For I = 1 To zone.Cells.Count
If Left(LCase(zone.Cells(I).Value), 5) = LCase(nomcherche) Then
j = j + 1
nomcherche1 = zone.Cells(I).Value
Set plage = Range(zone.Cells(I).Offset(1, 0), zone.Cells(I).Offset(ActiveSheet.UsedRange.Rows.Count, 0))
ReDim Preserve tableau(0 To j - 1, plage.Rows.Count)
nb = 0
For Each c In plage
tableau(j - 1, nb) = c.Value
nb = nb + 1
Next c
End If
Next I |
je remplie le tableau par raport a certain colonne de la feuille.
le problème c'est quand j passe à 2 il ya un probleme dans cette ligne de code
Code:
1 2
|
ReDim Preserve tableau(0 To j - 1, plage.Rows.Count) |
il me disent error 9,l'indice n'apartient pas à la séléction.quand je mets un evaleur fixe ça marche.
peur-être quelq'un pourrait m'aider