2009-05-01

Learning VBA

A few years ago, I have raised the use of VBA in the company.
Now it is the time for my colleague to teach the new comers about it.

Here is a list of stuffs that where is the start to learn and where is the level becoming master.
1. Studying Excel basic functions:
a. Formulas:
i. address related: index, indirect if, iserror, array formula
ii. calculation related: sumif, subtotal
iii. resolving address: row,col, address, indirect
iv. condition: if(and/or/not), iserror
v. array formula
take a little practice also with formula auditing
b. Features :
pivot table, consolidation, import text /web
c. Charting:
be familiar with data range/axis/legend
d. Formating:
Cell formating: Custom formating, conditional formating,
Data arrangement: filter (advanced filter)/sort page
Printing: page break view/ printing options
operation: paste special,
Input form solution: window freeze(ctrl+home), protect(Tab for navigation), validation,
Position:R1C1(R1C1 vs R1C[-1]), Naming, copy and paste with formulas reference ($A$1 vs $A1)

Actually most of the above function could be replaced by some VBA code,
However, it is recommended to employ the original Excel function as they are much efficient and "bug free"

2.VBA
a. Most importantly: Record macro and edit it.
b. Basics: variable, dynaming array, looping, sub and function (By ref/By val), global/public/private, msgbox
c. Excel Related:
i. application.workbook.worksheet.range("Range Name")
ii. selection.copy/activesheet.paste
iii. Calculation, screenupdating
iv. try to launch the code in legacy version of excel (2000/XP/2003) if needed,
some option are not be available in the those legacy version, thus causing error.
d. with other application:
Files(FileSystemObject),API,Data Access(ODBC/JET), Inter office component
e. Excel as input form: Form show/Hide, sheet controls
f. programming practice: modulisation,naming convention

If you also working on other Languages too,
you should also familar with how to connect to excel too.
E.g. using com object in pre-.net language.
and using interop in .net languages.

No comments:

Post a Comment