Skip to content

VBA101 — ReDim target undefined

Severity: 🔴 error Category: declaration Phase: 1.4

Description

ReDim is applied to a name that has not been declared as a dynamic array.

Failing example

ReDim notDeclared(1 To 10)

Compliant example

Dim arr() As Long
ReDim arr(1 To 10)

How to fix

Declare the array with Dim arr() As Type first.


Source: src/rules.py — entry VBA101.