> ## 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.

# Shortcut Key to Comment/Uncomment Blocks of Code in VBA
- URL: https://nolongerset.com/block-comment-shortcut-key/
- Published: 2022-04-19T02:13:36.000Z
- Updated: 2026-05-08T12:58:12.000Z
- Description: You don't need 3rd-party tools to add keyboard shortcuts for commenting and uncommenting code blocks in VBA with this trick.
- Author: Mike Wolfe
- Tags: Quick Tip, Hidden Features, #Import 2026-05-20 02:59

One thing that is conspicuously missing from the VBA IDE is a keyboard shortcut to comment and uncomment blocks of code.

The VBIDE *does* provide commands for commenting and uncommenting blocks of code, though. And by adding those commands to the menu bar, we can assign "accelerator" keys to make it easy to use the keyboard to trigger these two commands. "Accelerator" keys are the underlined letters in menu commands that you can use to massively boost your productivity for frequently used commands.

Follow the steps below to assign the following shortcut keys to comment and uncomment blocks of VBA code:

- **\[Alt\] + \[C\]**: comment code block
- **\[Alt\] + \[U\]**: uncomment code block

## Step-by-Step: Adding Comment/Uncomment Block Shortcut Keys

1. Enter **Customize mode**: View > Toolbars > Customize... (\[Alt\] + \[V\], \[T\], \[C\])
2. Go to the "**Commands**" tab
3. Go to the "**Edit**" category
4. Scroll to "**Comment Block**" command in Commands list
5. Click and drag "**Comment Block**" to the end of the toolbar
6. Click and drag "**Uncomment Block**" to the end of the toolbar
7. Right-click the "Comment Block" icon and set the name to "&**Comment Block**"
8. Check the box next to "Image and Text"
9. Repeat steps for "Uncomment Block" and set name to "**&Uncomment Block**"

You can now comment blocks of code with \[Alt\] + \[C\] and uncomment blocks with \[Alt\] + \[U\].

## Screenshots

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

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

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