Vba recording a macro in Excel
There are numerous ocassions, when the programmer is stuck in the middle of the coding and not in position to obtain immediate help.
Even a well versed programmer may get struck at one point or the other.
For example, a programmer might want to do a filter along a column, but is not sure of how to get it done with right statements.
The excel offers an excellent help utility for this, "Macro Recording".
With this feature, one can simply set up excel to record further actions in a VBA macro and once done, it can be stopped and viewed to get the corresponding code.
This is a salient feature of Excel and is most helpful and first source of help acquired by any programmer.
For example, the following code is a recorded macro, which is obtained by activating various sheets in this workbook.
- Sub Recorded_Macro()
- ' Recorded_Macro Macro
- Rows("19:19").RowHeight = 16.5
- End Sub
The screenshot from the editor is as shown below:
Note that, this feature is simply used to get help on syntax and logic and cannot be used, at the least, in most cases, as a regular working macro.
Also, note that, the above code is not in a proper structure.It just records every user action in that order, rather a good program is well structured and\
readable, though, they both perform the same action.
The following screenshots demonstrates the macro recording: