Creating an invoice by the hit of a button

Allround_it_er

New Member
Joined
Aug 5, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I have a table, containing orders from different clients, different items, ordered on different days.

I would like when the users hits the commandbutton, vba should ask for what client (showing a dropdown with all the clients who have ordered).

When the user clicks the client, an invoice is made for that client, just 1 invoice/client regardless the dates the client ordered. VBA should count the amounts together.
An example is attached.

So, the user should be able to click a dropdownbox, choose a client and make an invoice where the articles that have been ordered on several days but sometimes with the same article number, should be created as ONE single order line by counting the amounts together, if the client and the Article number are equal.

Once an invoive is made, there should be a new colomn that says, "invoice created" and a second colomn with drowdown "YES/NO". If value = Yes then the order line should be completely transferred to an new sheet (Archive invoices)

Appreciate your help!



Any help is much appreciated.

This is the code I use to put all the orders lines from one ordernumber (could be several lines) to the invoice. But it doesn't add up the amount. And I can't get it right after several hours of trying.

VBA Code:
  'Loop through the Invoicing sheet and as long as the invoice number doesn't _
  'change, write it to the table on the invoice
  startTableRow = 19
  Do While Worksheets("Bestelde Artikelen").Cells(x, 9).Value = invoiceNumber
   invoicingDate = Worksheets("Bestelde Artikelen").Cells(x, 1).Value
   invoiceArticleNumber = Worksheets("Bestelde Artikelen").Cells(x, 3).Value
   invoicingArticle = Worksheets("Bestelde Artikelen").Cells(x, 4).Value
   invoicingQuantity = Worksheets("Bestelde Artikelen").Cells(x, 5).Value
   invoicingPrice = Worksheets("Bestelde Artikelen").Cells(x, 8).Value
   invoiceComment = Worksheets("Bestelde Artikelen").Cells(x, 7).Value
   'invoiceDiscount = Worksheets("Klanten").Cells(x, 9).Value
   Worksheets("Factuur").Cells(startTableRow, 2) = invoiceArticleNumber
   Worksheets("Factuur").Cells(startTableRow, 3) = invoicingArticle
   Worksheets("Factuur").Cells(startTableRow, 6) = invoicingQuantity
   Worksheets("Factuur").Cells(startTableRow, 7) = invoicingPrice
   Worksheets("Factuur").Cells(startTableRow, 8) = invoiceDiscount
   Worksheets("Factuur").Cells(38, 2) = invoiceComment
   Worksheets("Bestelde Artikelen").Cells(x, 12).Value = "Jaa"
   x = x + 1
   startTableRow = startTableRow + 1
  Loop
  
  'Need to subtract one from x to loop through the row again
   x = x - 1
 

Attachments

  • Tabel orders 2.jpg
    Tabel orders 2.jpg
    43 KB · Views: 6
  • Tabel orders.jpg
    Tabel orders.jpg
    67.4 KB · Views: 7

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Making an invoice by hitting the commandbutton - OzGrid Free Excel/VBA Help Forum
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,215,586
Messages
6,125,683
Members
449,249
Latest member
ExcelMA

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