As we have already mentioned and surely you should also know, this powerful tool is widely used for making invoice design.
In this article we will focus on a section that you may not have known about or thought was possible with this application. For this you we will show how to create automatic consecutive numbering.
Perhaps you have been doing this work manually for a long time and have tracked each of the invoices you have issued. Not knowing that there is a very quick and easy way to create this account automatically. And this through the editor in Visual Basic, then we will tell you what you need to do to put this feature into practice.
How to create automatic consecutive numbering using VBA code in Excel
In another article we touched on the point of using the VBA macro to search for words in a range or range of cells and highlight them. But now we will focus on how to create automatic consecutive numbering using the codice VBA in Excel.
What we want to achieve, what we are looking for is that every time a new invoice is issued, the numbering of each of them is automatically increased. For example, if today we make an invoice with invoice number 01, it should automatically appear on the line Invoice number 02 on the next invoice.
If we already understand what we are looking for with the use of these Exel functions, we can get started and the first thing we will do is embed some code in the Macro di Visual Basic. To do this we will go to the Macro we have already created. This can be called New Invoice, New Invoice or simply Invoice.
Inserting the code into the VBA macro
So we want every time we create a clip in the New Invoice macro, a new one is created, but in the section of the invoice number which is in cell G7 it is increased. For this we go to the Macro, select and create a right clip, this action will display several options, from which we will select Assign Macro.
And now we select the Edit Excel Macro option, here we will find the start of the Macro, the name, the different codes that the Macro will execute and the end. With the cursor we stop to the last code before the end of the Macro. We will then press the Enter key and copy the following Interval code ("G7"). Value = Range ("G7"). Value + 1
Note that in the code the variable G7 corresponds to the cell where you want the invoice number to change consecutively. You have to enter the corresponding cell on your invoice, now we just have to close all the new windows that we open. And in this simple way it comes created automatic consecutive numbering using VBA code in Excel.
Now you just have to check if the code that has been embedded in the Macro works optimally. So to do this, we need to make a clip on the New Invoice Macro and this action will generate a new invoice and we will realize that the numbering is automatically increased.
We hope this tutorial has been to your liking and allows you to work with yours invoices more quickly and orderly, leaving the calculations to the application. In this way we finish a new article which in a very simple way shows you how create automatic consecutive numbering using VBA code in Excel.TagsEccellere