How to Create an Excel Invoice Number Counter

Written by ken burnside Google
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Create an Excel Invoice Number Counter
(computer image by blaine stiger from

Excel is commonly used to generate invoices for small businesses. Getting Excel to generate automatically incrementing invoice numbers requires digging into the Excel Visual Basic editor; this is often the very first macro a novice Excel user makes.

Skill level:

Other People Are Reading

Things you need

  • Excel 1995 or later.

Show MoreHide


  1. 1

    Create an invoice in Excel, and save the file as "Invoice.xls"

  2. 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. 3

    Press the "Alt" and "F11" keys at the same time. This will open the Visual Basic editor.

  4. 4

    Within the Visual Basic editor, press "Ctrl"+"R" to open the Project Explorer window.

  5. 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. 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 + 1

    End Sub"

  7. 7

    Save and reopen the file. Every time the Invoice.xls file is opened, the number in cell A1 will have 1 added to it.

Tips and warnings

  • If you're doing this in Excel 2007, the file name will be Invoice.xlsx, and should be referenced as Invoice.xlsx in Step 5 above.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.