Automatic numbering in a macro!!

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Sorry Steve, there's 1 template for my invoices i'm
using for every invoice for that 1 workbook. I would like
to have each new invoice be the next number in sequence.
I don't know what the process is needed to get there and
change it, too see if any constraints that are there.
I'd appreciate your help! Thank you
..
..

..
 
Hi Bob
one way: put the following code in the workbook module of your file:
Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Range("A1").Value = Range("A1") + 1
End Sub

This will increase cell A1 on sheet 'Sheet1' by one each time you open
the workbook
HTH
Frank
 
-----Original Message-----
Hi Bob
one way: put the following code in the workbook module of your file:
Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Range("A1").Value = Range("A1") + 1
End Sub

This will increase cell A1 on sheet 'Sheet1' by one each time you open
the workbook
HTH
Frank
need
is the TOTAL step by step process to do ALL of this.
What happens right now, from an earlier attempt, when i
open the invoice..." disable macros/ enable macros/ more
info" comes up...when i open either disable or enable
macros, the invoice comes up and the number of the invoice
is there in column D27. Is there any more info you need
from me? I'd appreciate your help....Thank you.
 
Hi Bob,
o.k. lets try a step by step approach
1. Create a new workbook or open an existing workbook. Design
everything as you like, etc. You will dedicate a single cell for your
invoice number. Lets say a an assumption it is cell A1 on the first
sheet (name 'sheet1').
2. Save this Excel sheet :-)
3. Right click on the Excel symbol left to your menu entry 'File'.
Choose 'Code' in the context menu. The VBA editor will open.
4. Paste the following code into the VBA editor:
Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Range("A1").Value = Range("A1") + 1
End Sub

You have to change the name of the sheet in the second line and the
cell reference in line no. 3

5. Close the VBA Editor and save your workbook.
6. Re-open the workbook and cell A1 should increase

HTH
Frank
 
-----Original Message-----
Hi Bob,
o.k. lets try a step by step approach
1. Create a new workbook or open an existing workbook. Design
everything as you like, etc. You will dedicate a single cell for your
invoice number. Lets say a an assumption it is cell A1 on the first
sheet (name 'sheet1').
2. Save this Excel sheet :-)
3. Right click on the Excel symbol left to your menu entry 'File'.
Choose 'Code' in the context menu. The VBA editor will open.
4. Paste the following code into the VBA editor:
Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Range("A1").Value = Range("A1") + 1
End Sub

You have to change the name of the sheet in the second line and the
cell reference in line no. 3

5. Close the VBA Editor and save your workbook.
6. Re-open the workbook and cell A1 should increase

HTH
Frank





.
 
Back
Top