Table of Contents

VBC09358 — For control variable already in use

Severity: Error  ·  Family: VBC (static semantics / abstract syntax tree)  ·  Source metadata: VBCompileErrorInfo

A loop is controlled by the variable of a loop it is nested in.

Each For loop counts with its own control variable: a loop nested in another cannot count with the same one, which the outer loop counts with.

MS-VBA reports the same error, with the same message (recorded in Excel).

This code is raised by StatementStaticSemanticsEvaluator.

How it is raised

Situation Example Resolution
The same variable in two nested loops. For i = 1 To 2 … For i = 1 To 3 Give the inner loop a variable of its own.

See also


⏮️ VBC09357 Array already dimensioned | ⏭️ VBC09359 Invalid Next control variable reference


ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca