Je veux Redim Preserve
un tableau je continue à obtenir l'erreur «indice hors de portée». Je suis conscient du fait que seule la taille de la dernière dimension peut être modifiée. C'est exactement ce que je fais. Qu'est-ce qui ne va pas ici? Le type du tableau est Variant
.Redim Preserve donne 'indice en dehors de la plage'
BmMatrix = Sheets("BENCH").Range("a60", ActiveSheet.Range("a60").End(xlDown).End(xlToRight))
'totaal gewicht per subdeel in array wegschrijven
Dim aBmMatrix()
aBmMatrix = BmMatrix
rij = UBound(BmMatrix, 1)
kol = UBound(BmMatrix, 2) + 1
ReDim Preserve aBmMatrix(rij, kol)
TotGewKol = UBound(aBmMatrix, 2)
For i = 2 To UBound(BmMatrix, 1)
g = 0 'g wordt totaal gewicht van land bv
If BmMatrix(i, bm_kolom) <> "x" Then
For j = 2 To UBound(bmexnul, 1)
If bmexnul(j, weightkolom) = BmMatrix(i, bm_kolom) Then g = g + bmexnul(j, 10)
Next j
End If
aBmMatrix(i, TotGewKol) = g
aBmMatrix(1, TotGewKol) = "Totaal gewicht" 'titel kolom
Next i