The easiest way to see the Visual Basic equivalents for common macro functions and Microsoft Excel commands is to use the macro recorder to record macros in Visual Basic. You can open two windows in your workbook: one window shows your Visual Basic module, and the other one shows the worksheet or chart you're working on while you're recording a macro. As you work, Microsoft Excel adds Visual Basic statements to your module.
No matter how you write your programs in Microsoft Excel, there are common tasks you'll want to accomplish, such as referring to ranges, controlling how macros run, accessing data in other applications, getting information about workbooks and objects, and creating procedures that run in response to certain events. The following table shows you where to look in this book for information about how to accomplish these tasks with Visual Basic.
For information about |
See this chapter |
Referring to cells and ranges on worksheets |
Chapter 4, "Objects and Collections" |
Controlling the flow of a macro |
Chapter 3, "Controlling Program Flow" |
Accessing data in other applications |
Chapter 13, "Accessing External Data" |
Getting information about objects in Microsoft Excel |
Chapter 4, "Objects and Collections" |
Running procedures in response to events |
Chapter 11, "Automatic Procedures and OnEvent Procedures" |
Microsoft Excel version 7.0 also includes example code written in both Visual Basic and the Microsoft Excel 4.0 Macro Language. To see this code, open the workbooks in the Examples folder in the folder where you installed Microsoft Excel.