Skip to content

VBA106 — Erase target is not an array

Severity: 🔴 error Category: declaration Phase: 1.4

Description

Erase requires an array. Scalar variables cannot be erased.

Failing example

Dim s As String
Erase s

Compliant example

Dim arr() As Long
Erase arr

How to fix

Use s = vbNullString for a String, or declare an array.


Source: src/rules.py — entry VBA106.