Check out a new way to perform an old VBA trick

by Kara Soos

Application:

Microsoft Excel 2000/2002/2003/2004/2007

Operating Systems:

Microsoft Windows, Macintosh

 

In the April 2008 article titled “Don’t count colored cells manually — do it with an easy-to-use macro,” I couldn’t help but notice how complex the macro looked for calculating the number of colored cells. While the solution you showed was technically perfect, I think many readers (including myself), may have found it confusing and hard to follow. I’m a big fan of using the For Each ... Next construct whenever I can in my macros. It makes things easier because you don’t have to set up any counters to track the number of loops, requires fewer lines of code to write, and is easier (I think) for beginners to understand. My mantra in writing VBA code is the simpler the code, the better!

 

Eric Augusta

Owner/Principal

 

Join Now Close