I I just really got this question it says some hi barb is there a way or
formula that a self-generating reference number is created each time I open a
document I'm in logistics and we're sending multiple shipments every day and
I'm always manually creating these reference numbers with the use of a
little Goods out of the book you would appreciate your help with this so what I
did is I don't know what they're doing but I assume it's a sales type thing so
I've got a basic form here and it's got the sales order number is four then you
would put in the customer and let's say Smith's company and description is okay
so now let me show you the code basic or I also have a Save button on here so
we'll look at both code so what I've done is that gone and I've got I right
clicked on this sheet tab on the sheet tab to view code and then you go into
the view code here and then what I've done is I've selected selected the
workbook so when the workbook is open then you're going to workbook and it's
when it's on it's on open is the other thing that you're selecting here so when
the workbook is open then the range worksheet sheet 1 range see for it is
just you just add 1 to it now when this is open you want to clear
the fields that contain contents so that you clear the contents of f4 which is
the customer name and then you clear the contents of f6 which is the description
okay so now a button to close this so let me show you this so basically I have
a command button and it's declared two things I've declared a path and a string
name and so what I'm doing is I'm actively saving the workbook because we
need that the original workbook to me say
so that the number increments for the next one the path I have used use the
path I have a demo on my desktop so what I've done is I've gone to my folder and
I have right-click or just simply clicked on here copy this and drive it
back and don't forget to put the quotation marks on the beginning the
backslash at the end and then ending quotation marks and so what I'm going to
do is I'm going to name this file as sales order and then whatever number is
displayed in so it's going to be sales order and then for just taking the
display alerts fault equals false so we don't get to see the error that are you
sure you want to save this and then active workbook save as file path name
which we've done up here file name which we did here and file more file format is
Excel so it's just an ordinary workbook application display alerts equals true
active workbook clothes so let's go go run this see what it does so I've got
Smith company some stuff and then I'm gonna click on the Run button so right
now we're on four so we're gonna click on save so it's going to close
everything and then if I go to my to my file folder where it's saving I have
sales order 4 and now if I open up my sales order again
so so basically I have sales order five the customer name is cleared now the
description is cleared now and so this is how you get the number increment
every time you open the file and this is how you clear the fields for the
customer name and description and whatever else you would have in here so
I will include this code in my description of the video please
subscribe