Allround_it_er
New Member
- Joined
- Aug 5, 2022
- Messages
- 6
- Office Version
- 365
- Platform
- 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.
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