Friday 30 May 2014

Is Excel VBA The Correct Course For you

Who Might benefit from attending a VBA Class in Excel

If you just need to record a linear sequence of steps all you really need is a short session looking at recording in Excel.
As soon as you need the macro to make a decision you would need to understand how to structure a conditional logic statement in code

Eg. IF cell value is greater than let’s say 50000 then colour it in gold otherwise in a more tragic grey.
Then if you needed other values in the same column to be assessed you would need a line of code to offset (move) down one row and repeat the same action of colouring the cell

Then you might want to consider how will your macro know when to stop? If there are always 100 values to assess maybe 100 employees salaries you might want Excel to repeat (loop around)certain lines of code 100 times then stop. However, it could be each month there may be a different number of employees so you want the macro to run until there are no more cells with values (maybe a blank cell)
The first example would involve writing a For Loop in Code and the second one with a unknown number of employees would be described as a while loop

For loops and while Loops like IF statements require code to be written not recorded so the user would need to know the grammar rules of the programming language
Some macros involve interaction with the user. This could be responding to a message on the screen asking if they want the printing in colour or black or white or just informing them that the macro will take 30 minutes to complete and just go chill for a while. At the top end macros might involve the creation of elaborate forms.

Imagine in addition that a user was requested for date information or simply typed a date into cell in the format as “blessed year of our Lord 2009” instead of a correct date format you might want an error message or procedure to guide the users.
Whilst Excel has data validation and error handling functions without macros there is more flexibility with error handling with a macro.

It is also possible to get macro’s to run on an event. This could be a small event as the user moves from one cell to another macro’s could kick in if they make any mistakes. Alternatively if you worked on a trading desk and were expecting a file to be saved for you to work on but it was not expected to be completed until 8:00. You could alternatively, go home at 5:00 and get your macro to run on a timer event
Macro’s can also be used to create and share new functions. You could have 50 users assigning cars to staff based on three cells containing their grade, salary and length of service. Rather than having to rely upon their knowledge of conditional logic and lookup functions they could share functions on their spreadsheets making it easier to manage spreadsheet reliability than individual knowledge.

See our Course Outline EXCEL Introduction to VBA

No comments:

Post a Comment