VBC09356 — Wrong number of dimensions
Severity: Error · Family: VBC (static semantics / abstract syntax tree) ·
Source metadata: VBCompileErrorInfo
An element of an array is selected by the wrong number of subscripts.
An array declared with fixed dimensions has an element for each combination of one subscript per dimension: there are as many subscripts as dimensions.
MS-VBA reports the same error, with the same message (recorded in Excel).
This code is raised by ExpressionStaticSemanticsEvaluator.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| Two subscripts of a one-dimension array. | Dim a(2) As Long … a(1, 2) |
Write one subscript for each dimension. |
Notes
An array declared without dimensions (Dim a() As Long), or held by a Variant, gets them when the code runs: the number of subscripts is checked then, and a wrong one raises error 9.
See also
⏮️ VBC09355 Function call on left-hand side of assignment must return Variant or Object | ⏭️ VBC09357 Array already dimensioned
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca