Here is a sample of what you will find in lesson 21 of the downloadable Tutorial on Excel macros
Lesson 21 on Excel Macros (VBA):
VBA Code for Functions
There are three topics in this lesson:
- using Excel functions within macros,
- using VBA functions within macros,
- creating new Excel functions with VBA.
Some of the functions that you find in Excel are available through macros in this form:
this sentence sums the values of cell A1 to A32 and stores the total in cell C1.
are two VBA functions that you will use within your Excel macros:
The " If" statements are case sensitive. When
you test a string of characters and you do not know if the user will enter upper case or lower case letters, use the LCase or UCase functions within your " If" statement so that however the user enters his answer the statement will work.
LCase(Selection.Value)= "yes" then...
UCase(Selection.Value)= "YES" then...
We hope you have enjoyed this introduction to lesson 21
for more on this topic and a complete course on Excel macros download the
Tutorial on Excel Macros
Next Lesson: VBA Code and SQL