Nommer tableaux avec des variables
Bonjour à tous,
Si je sollicite votre aide aujourd'hui c'est pour savoir s'il été possible de créer des tableaux à partir d'une boucle ?
J'arrive à avoir Ubound du dernier tableau crée via la variable, mais si je veux avoir la même chose avec le deuxième j'ai une erreur 13 incompatibilité de type, comme si le tableau été vide...
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Sub tabl()
Dim p As Integer
For p = 1 To 5
Dim tablo_p() As Integer
max = Range("a65536").End(xlUp).Row
val_cherche = Range("c5")
ReDim tablo_p(1 To max)
For i = 1 To max
tablo_p(i) = Range("a" & i)
Next i
Range("a" & max).Offset(1, 0).Value = "10"
Next p
MsgBox UBound(tablo_p) 'ok
MsgBox UBound(tablo_2) 'échec
End Sub |
Ou alors j'ai mal fait quelque chose...
En espérant avoir été assez clair.
Merci pour votre attention et vos futures réponses
nommer tableaux avec des variables
bonjour,
peut-être ceci
Code:
1 2 3 4 5
| Dim truc As Variant
For c = 1 To 5
truc = "dim tablo_" & c & "()"
Cells(c, 1) = truc ' uniquement pour vérifier si le résultat attendu est bon
Next c |
cordialement