changing calculations in a cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to add a function that will automatically add 1 number at a time in a cell by calculating only that cell. Reason-I want my invoice # to increase by 1 each time I use it.
 
Do you have to input the invoice number each time? Or,
could you just prenumber them, and input the rest of your
data? If they are sequential, once you put in your first
two numbers, click and drag over the two cells, release,
then click and hold on the fill box (lower right corner of
the cell) and drag down the column.

Cheers!
-----Original Message-----
I want to add a function that will automatically add 1
number at a time in a cell by calculating only that cell.
Reason-I want my invoice # to increase by 1 each time I
use it.
 
Paula said:
I want to add a function that will automatically add 1 number at a
time in a cell by calculating only that cell. Reason-I want my
invoice # to increase by 1 each time I use it.

Hi Paula
this can't be done with a formula. You'll need VBA for this. The
following code will increase the number in cell A1 on Sheet 1 each time
you open your workbook.
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
5. Close the VBA editor, save the Excel file and close it.

Now the number should increase everytime you open this file

Frank
 
Back
Top