I need a cell to change numbers each time it is opened up.
Is your template a true Template(*.XLT)
If not, open a new file and build your invoice layout on a sheet.
Enter this code in Thisworkbook module........to acces that module
right-click on the Excel Icon left of "File" and select "View Code"
Private Sub Workbook_Open()
if thisworkbook.path = "" then
'because the workbook is opened based upon a Template
'it's never been saved, so increment the number.
Sheet1.Range("B1").Value = Sheet1.Range("B1").Value + 1
end if
End Sub
Copy/paste the code into that module.
Alt + q to return to the Excel window.
FileSave AsFile TypeTemplate(*.xlt)
Gord Dibben MS Excel MVP
On Mon, 22 Dec 2008 15:31:01 -0800, Bcoleman75
wrote:
I need the formula or path to i guess to make a template and each time it is
open it generates a new number, Like a invoice number. For example. in cell
A1 Invoice #
in cell B1 we would have the number 1. then save it and then when you open
the template again the #2 would be in cell B1 automatically? can anyone help?
|