Here is a sample of what you will find in lesson 15 of the downloadable Tutorial on Excel macros
Lesson 15 on Excel Macros (VBA):
VBA Code for Worksheets
To develop a VBA procedure that is triggered by an event relating to the worksheet (when you select it, when you leave it...) see the VBA lesson on events.
You access a worksheet named " Balance" with:
You cannot select a sheet that is hidden so you will need to write:
The name of a sheet must not have more than 31 characters and should not include certain special characters like " ? : \ / [ ]" . If you do not respect these rules your procedure will crash.
The following lines of code will generate an error message:
You can not go directly from a sheet to a cell on another sheet. For example if the active sheet is "Balance" and you want tot go to cell A1 of a sheet named " Results" you cannot write:
We hope you have enjoyed this introduction to lesson 15
Next Lesson: VBA Code for Cells and Ranges