A PRIMER ON
MACRO PROGRAMMING WITH
Visual BASIC for Applications/Excel
by
Steven C. Chapra
Room 223 (Telephone: 617 727 3654)
e-mail: ******@
Civil and Environmental Engineering Department
Tufts University
Medford, MA
October 14, 1999
BIBLIOGRAPHY
• Walkenbach, John, Microsoft Excel 2000 Power Programming With Vba, IDG Books, Foster
City, CA, 1999, ISBN: 0-7645-3263-4, $ + shipping ().
• Walkenbach, John, Excel 2000 for Windows for Dummies : Quick Reference (--For Dummies),
IDG Books, Foster City, CA, 1999, ISBN: 0-7645-0447-9, $ + shipping
().
Tufts 1 VBA Primer
The Basics of Programming in Visual BASIC
Computer programming is not difficult. It really amounts to
• Learning several general concepts
• Being careful, organised and logical
• Practice
In this primer, we will outline the general concepts using the Visual puter
language.
There are only 8 fundamental concepts puter programming to
solve numerical problems confronted by engineers. These are
1. The “idea” of a program
2. Constants, variables, assignment and types
3. Mathematics
4. Decisions
5. Loops
6. Arrays
7. Macros, functions and subroutines
8. Input/output
The following sections provide some detail on each of these concepts.
1. THE “IDEA” OF A PROGRAM
A program is a set of instructions to tell puter to do something. The simplest
type is a sequence of instructions that puter implements one after another in a
mindless fashion. These instructions are sometimes called statements. For example, in
Visual BASIC
Sub Adder()
a = 10
b = 33
c = a + b
Msgbox c
End Sub
Although some of the words might seems alien, it’s not too difficult to see that the
computer will add two numbers together and then display the answer. In this case,
because we’re using Excel, we employ a “message box” to display the answer on the
spreadsheet.
A.Primer.On.Macro.Programming.With.Visual.BASIC.for.Applications-Excel 来自淘豆网m.daumloan.com转载请标明出处.