Good Morning John I hope your year is off to a great start. We're preparing to provide our Excel VBA Bootcamp to a couple of private clients, and I wanted to share a few best practices for creating clean, hassle-free Excel VBA code. Excel VBA Tip # 1 – Use Lower Case. Want a quick way for you to check your code and avoid errors on the fly? Try this: type your code in lower case and hit Enter. All of the Excel keywords will be capitalized. If a word you expect to be capitalized isn't, there's your clue that you've made a typo. You type: range(“d3”).select After hitting enter, it becomes: Range(“d3”).Select Excel VBA Tip # 2 – Create on Paper. You can save tons of time by creating your code on paper. Map out what you want the code to accomplish. Write (in plain English) the steps that will get you to that goal. Anticipate errors and try to prevent them. Hear me now or believe me later. I know it can seem tedious and you really just want to hit the ground running. After 20 years, I cannot stress enough how important it is to think through your code before you enter it into the VBE (Visual Basic Editor). You cannot skip this step, even if you are “borrowing” other people’s code to get the job done. My Excel VBA Bootcamp also provides a checklist you can use to dramatically speed up the process of creating on paper. Excel VBA Tip # 3 – Create in Blocks. This tip is especially important if the process you are trying to automate is long and complicated. Break your overall task into sub-tasks. Create code for each sub-task and test the code. Once all sections pass your test, merge them. Excel VBA Tip # 4 – Test, Test, Test Again Try to anticipate everything that can go wrong, and test your code. Excel VBA Tip # 5 – Document Use a comment to document each section of code. What is this code supposed to accomplish? What assumptions were made? Does this section of code require inputs? Documentation will be extremely useful when you review your code in the future. If you have questions or would like to schedule training, please call me (770-498-7333) or visit our contact link. Feel free to share with anyone else you believe will benefit. Thank you for reading and have a great weekend! Warmly, Jackie Kiadii, CEO Phoenix Computer Consultants, LLC Microsoft Certified Trainer (MCT), Microsoft Office Specialist Master t. 770-498-7333 e. [email protected] w. www.probiztechnology.com a. 1100 Peachtree Street Suite 200 Atlanta, GA 30309 l. http//www.linkedin.com/in/jkiadii |