Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Spreadsheets (https://www.askmehelpdesk.com/forumdisplay.php?f=395)
-   -   How do I create formula for sequential numbers in Excel? (https://www.askmehelpdesk.com/showthread.php?t=609611)

  • Nov 5, 2011, 06:14 AM
    rick141
    How do I create formula for sequential numbers in Excel?
    I need a macro so that every time I open the same excel file it increases my invoice number by 1 and saves the file. e.g. on opening file invoice number changes for alb00001 to alb00002 to alb00003 and so on
  • Nov 7, 2011, 11:55 PM
    JBeaucaire
    Format the cell in question with a custom number format of:

    "alb"000000

    Then put the number 1 in there to start, should appear as alb000001.

    Assuming that is Sheet1 cell A1, then this macro in the ThisWorkbook module will increment that number each time the workbook is opened.

    Code:

    Private Sub Workbook_Open()
      With Sheets("Sheet1").Range("A1")
          .Value = .Value + 1
      End With
    End Sub


  • All times are GMT -7. The time now is 12:56 PM.