2013-11-13, 15:13 #1
- Join Date
- Aug 2013
- Thanked 0 Times in 0 Posts
VBA: Subs and Functions: Navigating the IDE
I notice two things about Subs and Functions that require an argument:
1) They don't appear in the "Macro" dialog. (This is also true of all Functions, with or without arguments). I have to open a random module and use "Find" to locate it. Is there a listing somewhere that will show them all, so I can click and jump right to it?
2) I can't step through the Sub or Function unless its been called by another procedure. I realize that if I could do it, it would cause an error when it tries to use a "null" argument, but often that's a minor problem. Is there a way to do this?
Subscribe to our Windows Secrets Newsletter - It's Free!
Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!
+ Get this BONUS — free!
Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!
2013-11-13, 15:33 #2
- Join Date
- Feb 2001
- Willow Grove, Pennsylvania, USA
- Thanked 45 Times in 37 Posts
1) No, there is no general list of all procedures. Using the Find dialog is as good a way as any. It may help to name modules in a logical way and to group Subs and Functions into modules according to what they do.
2) No, there's no way to step into a function or a subroutine that has arguments without some caller that supplies the values of the arguments. If you tried it, you wouldn't get a null argument, you'd just get a runtime error (unless all the arguments are optional, but then they would always have default values). It's a good idea to write a Sub Test_XYZ() procedure at the same time that you write the Sub or Function, one that calls the Sub or Function with a variety of inputs. When you're about to distribute your work, simply comment out the Test routines -- you may want them back later.