
Excel VBA
Private Sub vs Sub in Excel VBA: All You Need to Know
Learn the difference between Private Sub and Sub in Excel VBA, with examples on scope, access control, and modular macro design.
Read article
4 lessons in order

Learn the difference between Private Sub and Sub in Excel VBA, with examples on scope, access control, and modular macro design.

Learn how to return values from a Sub in Excel VBA using ByRef parameters, global variables, or by converting a Sub into a Function.

Understand the difference between Function and Sub in VBA, how they return values, run actions, call procedures, and work in Excel cells.

Learn how and why to use Exit Sub in VBA, how it works, and practical examples for conditions, invalid data, and duplicates.