Shortcut keys

Here are the most important shortcut keys.

General

F1 Help - sometimes useful, sometimes not
F4 Open the properties window

Editing code

ALT+F11 Open the code editor
CTRL+Space Autocomplete - very useful
CTRL+S Save - do it often!
CTRL+Z Undo - I use this one a lot
TAB Indent the selected code
CTRL+G Open the immediate window, to try out code
CTRL+Y Delete the current line
ALT+Q Switch back to the worksheet

Debugging

F9 Set a breakpoint
F8 Run the next statement, stepping into Sub calls
SHIFT+F8 Run the next statement, skipping over Sub calls
CTRL+F8 Debug - Run until VBA reaches the line that's selected
CTRL+G Open the immediate window, to try out code

Long loops

What happens if you have an infinite or long loop? Redsome says:

  • Keep hitting the Escape button several times until your code stops. Then click End in the message box that appears.
  • Hit Ctrl+Break Button together. Then click End in the message box that appears.