Get Details in Excel VBA Code

Did you ever get an Excel file from someone else, and try to sort out their Excel VBA code? Or, even worse, open an Excel file that you wrote long ago, and try to remember what all those variables mean?

I spend lots of time staring at Excel code, but apparently I don't use the right-click menu too often, because I hadn't noticed a couple of handy commands until recently. These commands can help you decipher that mysterious code, and unravel the complicated sections.

Excel VBA Quick Info

The first handy command is Quick Info. I have Auto Quick Info turned on in the VBE Editor options, and it helps me remember the syntax as I type the code.


What I didn't realize was that you can right-click on a variable, function, statement, method, or procedure in the code, and click Quick Info.


A tooltip appears, with details on the selected item.


Excel VBA Definition

The other right-click command that I finally discovered is the Definition command.


Click the Definition command, and it takes you to the selected variable's definition. Finding the definition is easy in most procedures, but in a long procedure, with a long list of variables, the Definition command really makes the job easier. It's especially helpful if the variable is defined on a different code module!



You may also like...

6 Responses

  1. Dominik Petri says:

    If you prefer the keyboard:
    Ctrl+I shows the Quick Info
    Shirt+F2 gets you to the definition and
    Ctrl+Shift+F2 gets you back to the codeline


  2. Allan says:

    Thanks from for pointing that out, Debra. That will definitely come in handy.

    Checking in from Willowdale,

  3. Nick says:

    I definitely like the Quick Info tip, I had not used that option before. However For the Definition Command, that’s equivalent to the keyboard shortcut I use all the time: Shift-F2. This will jump to to the definition of the variable, and then you can press CTRL-SHIFT-F2 to return back to where you were. Very handy!

  4. @Dominik and @Nick, thanks for the keyboard shortcut!

    @Allan, thanks, and it would be nice if we could use that Quick Info feature on the civic election ballots today. ;-)

  5. Rick Rothstein (MVP - Excel) says:

    Just so your reader’s know, Definition does not only work for variables… you can use it for functions and subroutines as well. Just put the text cursor on a function name or subroutine call, activate Definition and you will be taken to the first line of the function or subroutine.

  6. Gregory says:

    Good post, great discussion. I learned two things that will help me. 1) the Ctrl+I shortcut for Quick Info, and 2) that after using the Shift+F2 to find the first line of a function or subroutine, you can use Ctrl+Shift+F2 to return to your starting point, even if it’s in another module.

Leave a Reply

Your email address will not be published. Required fields are marked *