Sunday, July 17, 2011

How to Create an Excel Invoice Number Counter


1. Create an invoice in Excel, and save the file as 'Invoice.xls'
2. Enter your initial invoice number in cell A1. For example, if your initial invoice number is 300, you'd type 300 in cell A1.
3. Press the 'Alt' and 'F11' keys at the same time. This will open the Visual Basic editor.
4. Within the Visual Basic editor, press 'Ctrl' 'R' to open the Project Explorer window.
5. Double click the line that says VBA(Invoice.xls). When the menu opens up, double-click 'ThisWorkbook,' which is a special function in Visual Basic detailing how operations on this workbook will operate. A pane will show up on the right.
6. Enter the following text, exactly as shown here, in the pane on the right, without the quotes. The line breaks are important -- this should show up on three lines in the window.'Private Sub Workbook_Open()Range('a1').Value = Range('a1').Value 1End Sub'
7. Save and re-open the file. Every time the Invoice.xls file is opened, the number in cell A1 will have 1 added to it.

Blogger news