Quickly fix common code issues across a procedure, module, or project.
From the Inspection Results toolwindow, select an inspection result; the Fix dropdown menu lists all available quick-fixes for the selected result. Alternatively, simply right-click the result you want to apply a quick-fix to, and select the appropriate fix from the context menu.
Keep in mind that while static code analysis can easily and reliably spot syntactical elements (e.g. access modifiers, implicit keywords, etc.), analysis of code semantics is only as accurate as the internal representation of the code, and while 100% accuracy is the goal, in many cases it’s simply impossible: late-bound member calls (implicit or not) cannot be resolved, for example procedures invoked outside the VBA project (e.g. Excel user-defined functions, macros invoked by Access reports, etc.) are going to be reported as not used. Never blindly apply a quick-fix across an entire scope, module, or project, without first reviewing every individual result for a given inspection.
Exactly what a particular quick-fix does is entirely up to its implementation, but running any quick-fix will trigger an automatic reparse.
This tab lists all items found in the .xml documentation assets from the latest pre-release build. To modify this content, a pull request must be merged into the [next] branch.
Modifies a Workbook.Worksheets or Workbook.Sheets call accessing a sheet of ThisWorkbook that exists at compile-time.
Adds an annotation comment to document the presence of a hidden module or member attribute.
Adds an identifier or Hungarian Notation prefix to a list of white-listed identifiers and prefixes in Rubberduck's inspection settings.
Exports the module, adds the hidden attributes as needed, re-imports the temporary file back into the project.
Adds an explicit Step specifier to a For loop instruction.
Adjusts existing Rubberduck annotations to match the corresponding hidden attributes.
Adjusts existing hidden attributes to match the corresponding Rubberduck annotations.
Adds an '@EntryPoint annotation to mark as an entry point a procedure that isn't intended to be invoked by any code.
Replaces a late-bound Application.{Member} call to the corresponding early-bound Application.WorksheetFunction.{Member} call.
Introduces a new local variable and assigns it at the top of the procedure scope, then updates all parameter references to refer to the new local variable.
Replaces the Dim keyword with Private in a module-scoped declaration.
Changes 16-bit (max value 32,767) Integer declarations to use 32-bit (max value 2,147,483,647) Long integer type instead.
Adjusts a Sub procedure to be a Function procedure, and updates all usages.
Adjusts a Function procedure to be a Sub procedure. This operation may result in broken code.
Assigns an explicit data type to an implicitly typed declaration.
Adds an explicit Variant data type to an implicitly typed declaration. Note: a more specific data type might be more appropriate.
Runs the 'Encapsulate Field' refactoring, which prompts for identifier names for the new property and its value parameter.
Replaces bang operators ('dictionary access') with explicit default member calls.
Makes default member calls explicit.
Adds an '@IgnoreModule annotation to ignore a inspection results for a specific inspection inside a whole module. Applicable to all inspections whose results can be annotated in a module.
Adds an '@Ignore annotation to ignore a specific inspection result. Applicable to all inspections whose results can be annotated in a module.
Introduces a 'Property Get' member to make a write-only property read/write; Rubberduck will not infer the property's backing field, the body of the new member must be implemented manually.
Introduces a local Variant variable for an otherwise undeclared identifier.
Replaces misuses of the IsMissing function with the appropriate default value for the specified parameter type.
Rewrites a parameter declaration that is split across multiple lines.
Moves field declaration to the procedure scope it's used in.
Adds 'Option Explicit' to the top of code modules.
Modifies a parameter to be passed by reference.
Modifies a parameter to be passed by value.
Qualifies an implicit reference with 'Me'.
Removes an annotation comment representing a hidden module or member attribute, in order to maintain consistency between hidden attributes and annotation comments.
Removes a hidden attribute, in order to maintain consistency between hidden attributes and (missing) annotation comments.
Removes a comment.
Removes a duplicated annotation comment.
Removes an empty Else block.
Removes an empty conditional block by inverting the condition expression.
Removes an explicit ByRef modifier, making it implicit.
Makes a call statement implicit by removing the 'Call' keyword, adjusting argument list parentheses accordingly.
Makes the 'Let' keyword of a value assignment implicit.
Makes the 'Local' keyword of an 'On Error' statement implicit.
Removes 'Option Base 0' statement from a module, making it implicit (0 being the default implicit lower bound for implicitly-sized arrays).
Removes 'Step 1' specifier from 'For...Next' loop statement, 1 being the implicit default 'Step' increment.
Removes 'Stop' instruction.
Removes type hint characters from identifier declarations and value literals.
Removes the declaration for a variable that is never assigned. This operation may result in broken code if the unassigned variable is in use.
Removes an instruction that references a variable that isn't assigned. This operation may break the code.
Removes the declaration for a constant, variable, procedure, or line label that isn't used. This operation can break the code if the declaration is actually in use but Rubberduck couldn't find where.
Refactors a procedure's signature to remove a parameter that isn't used. Also updates usages.
Prompts for a new name, renames a declaration accordingly, and updates all usages.
Replaces empty string literals '""' with the 'vbNullString' constant.