Quick Code Navigation

I am a big proponent of using shortcut keys. Some people may not think that using shortcut keys is worth the effort of remembering them. After all, how much time are you really saving? Well, programming involves a lot of keyboard input, which means that both your hands need to be on the keyboard. When you use the mouse, you have to remove a hand (assuming you're not using an exceptionally pokey pointing stick or equally slow touch pad), grab the mouse, navigate to the menu/ toolbar/scrollbar, make your selection, return your hand to the keyboard, and finally reorient your hand so that your index finger is over the J. When you use a shortcut key, this whole sequence is replaced by one keystroke.

I haven't conducted any scientific studies on this, but how much time does a keystroke take? Less than a tenth of a second perhaps. How about an operation involving the mouse? Consider that if you have to do some scrolling, you may occasionally take 5 to 10 seconds. For more simple mouse operations, I'd guess that it takes at least a couple of seconds between your last keystroke before the mouse operation and the first keystroke after the mouse operation.

Recently, a Microsoft commercial aired in which a guy walks around the company telling everyone "We just saved a nickel." He finally tells some bigwig this, adding that they are saving a nickel on every transaction. The bigwig knows that the company happens to process five million transactions per month, so that means big savings. Using shortcut keys is the same kind of thing. Each one is only a small second or two in time savings, but when you spend all day doing this kind of thing, it all adds up to a substantial time savings over the course of a day.

Therefore, although I am not going to tell you the three ways to perform every action in the VBE (menus, toolbars, context menus) and show you every menu item and toolbar button, I am going to provide you with a list of very useful shortcut keys (see Table 2.1).

TIP You can choose from a few different strategies to learn shortcut keys. One strategy is the sink or swim method. Unplug your mouse for a day. This is difficult at first, but you really can use Windows without a mouse, and after you get to know the shortcut keys, you can use it quite efficiently. Print out all of the shortcut keys and put them by your monitor. The second method is to commit yourself to learning a few each day. Start with Cut (CTRL+X), Copy (CTRL+C), and Paste (CTRL+V).

This list is not a definitive list; rather it is a good selection of shortcut keys to get you started. You can obtain a complete list via your help files. See the Shortcuts section under the Visual Basic User Interface Help.

Table 2.1: Useful Shortcut Keys description

Cut the selected text to the clipboard.

Copy the selected text to the clipboard.

Paste the contents of the clipboard.

Move one word to the right.

Move one word to the left.

Select one word right.

Select one word left.

Next procedure.

Previous procedure.

Beginning of module.

End of module.

Move to beginning of line.

Move to end of line.


Delete current line. Delete to end of word. View Definition. Go to last position.















Two of the items in this table probably need a little more clarification. The View Definition shortcut key is very helpful when your projects start getting a little more complex. With View Definition, you can select a procedure name and press SHIFT+F2 to be taken to that procedure. To return to where you were or to go to your last position press CTRL+SHIFT+F2.

0 0

Post a comment