Invoice template

G

gandalf

While working with the Excel Invoice template, I saw, at one time, an
Invoice tool bar. I figured this would show up whenever I used the
Invoice spreadsheet.
But - now that I have made changes to it, I don't see it anymore.

Does anyone know how to get the Invoice tool bar to show up?
 
O

Otto Moehrbach

The Workbook_Open macro shown below will increment the number in cell A1
of the sheet named "MySheet" whenever the workbook is opened.
A word of caution: If you're like me you sometimes open the file with
the intention of preparing a Purchase Order but get side-tracked for one
reason or another and not finish the Purchase Order and shut down or close
the file. The number will have incremented as you wanted it to do. Then
when you come back and open the file again, the number will increment a
second time. You will lose the first number unless you manually change it
back, if you remember to do so.
If your system is tolerant of non-sequential numbers (lost numbers) then
use the Workbook_Open macro.
If you need to account for every number then I recommend that you use
the print command as the trigger to increment the number. This way, the
number will not increment until you print the document. Just an idea for
you to consider.
The macro to increment the number on the print command is the
Workbook_BeforePrint, shown below also.
Either way, you must put the macro you choose in the workbook module.
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. HTH Otto
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
 
G

gandalf

Thanks for the suggestions. I will try. However, I haven't used the
MACROs before. But what the heck, they can't be all that hard, ?:D
 
D

Dave Peterson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top