Macros are instructions/programs that tell the computer to do things. They're
very useful for repetitive actions that you want to take.
For instance, adding a number to a cell each time you either open the workbook
or print the worksheet. You could do it, but then you'd have to remember to do
it and you could make a typing mistake. Macros can have errors, too. But once
you debug them, they'll keep doing things as long as you want them to.
Otto wrote these two macros (pieces of code):
Private Sub Workbook_Open()
Sheets("MySheet").Range("A1") = _
Sheets("MySheet").Range("A1") + 1
End Sub
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("MySheet").Range("A1") = _
Sheets("MySheet").Range("A1") + 1
End Sub
He described the limitations of each in his post. But once you decide the one
you want, you'll can follow the instructions at David McRitchie's site to
install it:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
Otto also gave you the short course:
You access the workbook module by right-clicking the Excel icon to the left
of the "File" word in the menu across the top of the screen. Select "View
code". Paste the macro into the module displayed. "X" out of the module to
return to your file.
(paste just the one you want to use--either updating the value before you print
or updating when you open the workbook--don't paste both!)
But do remember to change MySheet to the correct name of your worksheet. And if
you choose the workbook_open macro, make a note of what's in A1 of that sheet.
Then close your workbook (remember to save it) and then reopen it. You'll see
that number go up by one.