Need a way to create invoice numbers automatically

Thriftlife

New Member
Joined
Jul 24, 2020
Messages
22
Office Version
  1. 365
Platform
  1. Windows
Hey needing a way for my company to use the invoice we have created and create a bunch of copies of it and give it its own unique invoice number.
The cell the invoice number will be in is I4
i would like it to save each copy as the same name as the invoice number, if thats possible. Or at least save each file without going in and manually saving each one.
We usually make 1300 or more copies of invoices that employees fill out, so trying to make it easier on us
,Thamks
 
I got this far, go it to change the number when its open and to saveas invoice number it was changed to.
Anyone know how to get it to make it does this without me opening each file?

Private Sub Workbook_Open()
Range("I4").Value = Range("I4").Value + 1
End Sub

Sub SaveAsA1()
ThisFile = Range("I4").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
End Sub
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Need to copy a file and rename it from a list i have created
 
Last edited by a moderator:
Upvote 0
Sub SaveMasterAs()
Dim wb As Workbook
Dim rNames As Range, c As Range, r As Range

'Current file's list of names and ids on sheet1.
Set rNames = Worksheets("Sheet1").Range("A2", Worksheets("Sheet1").Range("A2").End(xlDown))
'Path and name to master workbook to open for copy, saveas.
Set wb = Workbooks.Open(ThisWorkbook.Path & "\Invoice Numbers.xlsm")

For Each c In rNames
With wb
.Worksheets("Sheet1").Range("A2").Value = c.Offset(, 1).Value 'ID
'Path and name for copied workbook
.SaveAs Filename:=ThisWorkbook.Path & "\2021" & c.Value & ".xlsm", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
End With
Set wb = ActiveWorkbook
Next c
wb.Close
End Sub

Cant get this to work can someone help with it
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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