No announcement yet.

Save template as new file and increment invoice number in template

  • Filter
  • Time
  • Show
Clear All
new posts

  • Save template as new file and increment invoice number in template

    Main Invoice1.xlsxHello,

    I am trying to build an invoice template with incrementing invoice numbers. I was able to find the proper code on the site to make that work, but I now running into new problems which i was unable to find the code for.

    I want to make changes to the template and then save it as a new file and have the template stay as it was when I first opened it, but for it to have a new invoice number when I reopen it for a new invoice. I am also having a problem with not having the code carry over to a new excel sheet after I have saved it.

    I hope I am making sense and I apologize for asking a question that might have already been answered as I was unable to locate it. Below is the code and the file is attached.

    Private Sub Workbook_open()
    'Change the sheet and cell reference to where the invoice number is located
    With Sheets("Invoice").Range("M3")
    .Value = .Value + 1
    End With
    End Sub
    Private Sub Workbook_close()
    End Sub
    Last edited by AAE; November 2nd, 2010, 19:47. Reason: revise thread title, add code tags

  • #2
    Re: Excel VB Code Help

    Your thread title is not very search friendly.

    However a quick search of the site returned several results.

    Look here

    Do a search for saveas name in cell will reyurn more.


    • #3
      Re: Save template as new file and increment invoice number in template

      Hello arin04,

      Welcome to Ozgrid.

      Thread titles are key to obtaining good search results and the new thread page is clear about the requirement to write titles that properly describe your thread.
      While "Excel VB Code Help" may express your personal need, in no way does it begin describe your thread or objective and is, therefore, of no use to others searching the forum for a similar solution. In future threads, please craft titles that use only search friendly key words that accurately describe your thread.

      All VBA code posted to the forum must be wrapped in code tags, which you omitted. I've added the tags for you this time only. Be sure to use themin future posts.

      How to use code tags: [code] your code here [/code]

      Forum Rules | Message to Cross Posters | How to use Tags