Ich habe dieses vereinfachte Code, wo infosOptions
eine globale Variable mit verschiedenen Typen drin ist:Warum Redim Typ Mismatch Fehler verhindern?
Dim optionsVecteur As Variant
For j = 0 To UBound(infosOptions)
If infosOptions(j, 11) & " Index" = transac.optionName Then
optionsVecteur(1) = infosOptions(j, 6)
optionsVecteur(2) = infosOptions(j, 5)
optionsVecteur(3) = infosOptions(j, 10)
Exit For
End if
End j
ich auf optionsVecteur(1) = infosOptions(j, 6)
einen Typenkonflikt Fehler haben, aber wenn Redim optionsVecteur(3)
setzen es funktioniert, warum?
Da eine eindimensionale Matrix nicht das gleiche wie eine zweidimensionale Anordnung ist. – braX
Standardmäßig ist 'optionsVecteur' ein eindimensionales Array. Das ist der Grund, warum du 'Redim' brauchst. –
Vielen Dank für Ihre Antworten. Es ist also nicht wirklich ein "Typ" -Diskont, sondern ein Dimensionsfehler! – TmSmth