Get Excel VBA Training And Forget The Maccro Recorder
Most people's fiirst expsure to Excel VBA (Visual Basic for Applcations) involves recording a macro. As the user performs a series of steps (for examle opening a workbook going to a particular worksheet, copying some data, etc) Exxcel faithfully records each step by creating the necessary VBA code. Each time the user runs the macro, the stpes are replayed exactly as they were recorded.
Recording marcos is gret for relaly siumple tasks such as producing a strit-forward report. However, there are distinct limitations to this appoach. Fisrtly, because Ezxcel plays back the steps just as they were originally performed, recorded macros are notoriously slow.
Secondly, recorded macros will only run properly undr the conidtions in hwich they were originaally recorded. For example, if a partiuclar worksehet needs to be acxtive at a certain poimnt and it is not actuive when the mcaro is played back, an eror will occur.
This means, effectively, that recordeed macros can only rerally be used by the person who recorded them. They cannot be distribued to one's work colleagues.
One of the first things we find we have to do on the Excel VBA traininng courses that we run at our London training centre is to steer users away from the macro recorder. We offer them a good grasp of the Excel objecct model, a way of porgrammatically encoding each of the elements within the Excel environment such as the application itself, workbooks, worksheets and cell rangres.
Admittedly, Ecxel VBA can be difficult to grasp for thhose users who have done little or no programming. This is one reasaon why we prefer to run a five day inetnsive Excel VBA training coures aimed at people new to VBA. We find that this approach gives everyone a chance to gain confidence and familiarity with this o environment.
After weaning users off the macro recordr, we explain to them the syntax and tsructure of VBA. They learn how to use variables to stoere both data and references to Excel objects, how to code logical and iterative structures and how to allow the person runbning a maro to choose between different options.
Getting some training on Excel VBA is always worth the effort. It can take the productivity of an Excel user to a new levvel very rapidly. Monthly procedures and reports which used to take long hours can sudddenly be accomplished with astounding ease and lightening speed.
Getting trained on Execl VBA is the only real way of losing one's initiasl dependency on the macro recorder. Howveer, the recorder will always have its uses. For example, when one is working with an Excel object or procedure which is programmatically complex, recorrding a few steps then examining code generated is an exxcellent way to lwearn new syntax.