Add Customer Specific Code in front of Invoice number

StevenRLaw

New Member
Joined
Oct 18, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hey,
I followed along with Chester at Blue Pecan to create a Macro Invoice database. everything is fine with that however I am adding a few personal items/functions.
The one I can not figure out is how to *** a customer specific code in front of the generated invoice number, in order to Identify it.

Example, The form generates a new invoice number each time you run the new invoice macro, when you "add to record" it saves it to the "record" worksheet. it saves it under the invoice number.
Then you can save it as PDF.... this is where I would like to have the code added in front of the invoice number like so...

the company name is Bobs House of Dogs... I would manually create a code for it like BHD-then invoice number.
it would look like this
BHD-1001.pdf

that's how I have been manually saving the records.

How can I change the Macro to add the code, the - and then the generated invoice number?

Sorry I hope I did'nt confuse the poo out of everyone...
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Who is Chester at Blue Pecan?

Can you post the relevant section of your macro?

Does the "code" exist somewhere in your worksheet or are your wanting to generate it somehow, and if so, what are the rules for doing that?
 
Upvote 0
I was searching for ideas on how to create a customer/invoice database and ran across his videos on Youtube... Link: How to Create an Automated Invoice Template in Excel –

as for the code here is what I have that saves it as .pdf to my specified location:

Sub SaveASPdf()

Dim invno As Long
Dim custname As String
Dim amt As Currency
Dim dt_issue As Date
Dim term As Byte
Dim Path As String
Dim fname As String
Dim nextrec As Range

invno = Range("F6")
custname = Range("A7")
amt = Range("H41")
dt_issue = Range("H6")
term = Range("F8")
Path = "C:\Users\Russell\Desktop\Database Files\PDF Invoices-Quotes\"
fname = invno & " - " & custname

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, ignoreprintareas:=False, Filename:=Path & fname



Set nextrec = Sheet6.Range("A1048576").End(xlUp).Offset(1, 0)
nextrec = invno
nextrec.Offset(0, 1) = company
nextrec.Offset(0, 2) = amt
nextrec.Offset(0, 3) = dt_issue
nextrec.Offset(0, 4) = dt_issue + term

Sheet6.Hyperlinks.Add anchor = nextrec.Offset(0, 6), Address:=Path & fname & ".pdf"
 
Upvote 0
I am going to create "codes" for the customers manually and just add a column to the customer worksheet, just not sure where to or what to tell the macro to do...

My first thought was to add to the very first "nextrec" code :
nextrec =custcode + invno

but that didnt work?
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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