Sequential Numbering

Caily

New Member
Joined
Jul 2, 2011
Messages
2
Hi, I am trying to set up a 'rent receipt' template that will save today's receipt with today's date in the file name, but also number the receipt itself sequentially. Thanks.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi Caily and Welcome to the Board
This will save the current worksheet to the current directory and call it Rent Receipt - todaysDate.
Code:
Sub SavingIt()
Dim Fname As String, sname As String
Application.ScreenUpdating = False
Fname = Format(Date, "dd-mm-yy") & ".xls"
sname = ThisWorkbook.Path
Set wb = ActiveWorkbook
        With wb
            .SaveAs sname & "\Rent Receipt- " & Fname
            .Close
        End With
Application.ScreenUpdating = True
End Sub
To number sequentially, you need to provide what number sequence you are using, 001, A1, 100, etc and the cell where this number will be stored.
At least you have a start on the filename
 
Upvote 0
Thanks so much Michael. It worked, yay.
I'm starting the receipt numbers at 001 in cell D4. If I use a template, will the numbers keep going up, or will it only work if I open last week's receipt and use it as the template for this week's receipt? Not sure how it all works. Thanks very much.
Caily
 
Upvote 0
If you want the number to change every time you open the workbook use this
Code:
Sub auto_open()
On Error GoTo Err
    With Range("D4")
    .Value = Range("D4") + 1
    .NumberFormat = "000"
    End With
Err:
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top