Table of Contents

RDC00313: Redundant Step 1

Severity: Information  ·  Family: RDC (Rubberduck Core analyzers)  ·  Raised by: ForStepAnalyzer

A For loop states Step 1.

A For loop with no Step adds 1 to its counter after each iteration (MS-VBAL §5.4.2.3 For Statement), so Step 1 changes nothing.

The diagnostic follows the Diagnostics.ForStep setting. With the default, Implicit, Step 1 is reported. With Explicit, a loop with no Step is RDC00116 instead. Both are legal VBA.

The finding is the step value.

How it is raised

Situation Example Resolution
A For loop that states Step 1. For i = 1 To 10 Step 1
Next
Remove Step 1.

Quick fix

The diagnostic comes with a quick fix, Remove Step 1. It removes the Step clause; the loop counts the same.

See also


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