> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Debugging Private Procedures
- URL: https://nolongerset.com/debugging-private-procedures/
- Published: 2021-05-08T03:27:19.000Z
- Updated: 2026-05-08T13:04:49.000Z
- Description: After more than 14 years as a VBA developer, I recently discovered that you can debug private procedures without temporarily making them public!
- Author: Mike Wolfe
- Tags: Hidden Features, Debugging, #Import 2026-05-20 02:59

One of the advantages of VBA being an interpreted language is that we can execute individual procedures without having to compile the entire application. Let's explore exactly how we do that.

## Public Procedures

### Public Routines with No Arguments

In a standard module, you can place the cursor inside of a Public Routine that has no arguments, press \[F5\], and that routine will immediately execute.

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/05/image-16.png)

Pressing F5 within a routine inside a *standard* code module will immediately execute that routine.

If you want to step through the routine, you can either set a breakpoint on one of the lines before pressing \[F5\] or simply press \[F8\] ("Step Into") and immediately begin stepping through the code for the routine.

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/05/image-19.png)

To step through the routine one line at a time, press F8 ("Step Into") instead of F5.

### Public Functions with No Arguments

This also works with public functions in standard code modules. The key is that the function cannot accept any arguments, not even optional ones.

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/05/2021-05-07-22_22_36-mjw20-Window.png)

Pressing F5 within a function executes it, though nothing is done with the return value.

### Public Procedures with Arguments

What happens if you try to execute a public procedure that takes one or more arguments (even optional ones)? The "Run > Run Macro" command executes:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/05/image-18.png)

Pressing F5 to execute a routine that takes arguments will instead execute the "Run > Run Macro" command.

## Private Procedures

### Private Procedures with No Arguments

I can't take credit for discovering this one. Special thanks goes out to [Terry Chapman](https://www.infoplan.com.au/) for passing along the fact that you can press F5 to debug **Private** procedures in place, not just Public procedures.

Like Terry, I used to temporarily change my Private procedures to Public while I was debugging them. It turns out, I never had to do that at all.

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/05/image-20.png)

Just press \[F5\] to run private procedures. You can step through using \[F8\], too!

### Private Procedures *With* Arguments

Once Terry got me questioning my assumptions, I decided to see just how much I could get away with. A lot more than I was expecting, it turns out!

Believe it or not, you can debug private procedures that take arguments *without* temporarily changing them to public procedures. To do this, you just need to call the fully qualified procedure name from the Immediate Window. By "fully qualified name", I mean the name in the format of `{ModuleName}.{ProcedureName}`.

Check out this example:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/05/image-22.png)

Wait for it...

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2021/05/image-24.png)

...BOOM!

But don't take my word for it. Go give it a try!

*Image by [Gerhard G.](https://pixabay.com/users/blende12-201217/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=1974166) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=1974166)*