Trying to Auto Clear a new template invoice, when I already have an auto clearing invoice on another sheet

Kym_beginner_in_VBA

New Member
Joined
May 21, 2022
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hi

I have been trying for the last 2 days to auto-clear a complex new invoice that I have created this week. My workbook already contains a working basic invoice for clients which is linked to an address table on another sheet. The 1st Invoice has 2 Macro buttons which was done last year, the 1st to clear the invoice and increment the invoice number, the 2nd to save the invoice as a PDF version. so that works all great. what I've had to do this year is create a shipping commercial invoice which I have now linked via dropdown and code to auto populate the client details from the same table i created last year, so that part works fine. I've also created a new items table which also auto sorts as I add more and more items to that table (in time I expect that table of items list to be many hundreds of items long!) The invoice I created has a max allowed number of 40 items which I can add to the invoice and all the automation on weights, prices etc. all work including the dynamic filter of only the items selected (non blank rows) go onto the invoice and any blanks up to a total of 40 items simply do not appear on the printable and viewed page until I select a new item from my table select item.
Now I've tried copying and writing the auto clear code a few times and I've searched online for how to make it work but I can only find the explanation for one invoice in a worksheet. I have tried opening a second module and trying my best with various tries, but I'm getting nowhere. I do have xl2bb downloaded too but there isn't an option for me in this post to upload the mini sheet.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I
Hi

I have been trying for the last 2 days to auto-clear a complex new invoice that I have created this week. My workbook already contains a working basic invoice for clients which is linked to an address table on another sheet. The 1st Invoice has 2 Macro buttons which was done last year, the 1st to clear the invoice and increment the invoice number, the 2nd to save the invoice as a PDF version. so that works all great. what I've had to do this year is create a shipping commercial invoice which I have now linked via dropdown and code to auto populate the client details from the same table i created last year, so that part works fine. I've also created a new items table which also auto sorts as I add more and more items to that table (in time I expect that table of items list to be many hundreds of items long!) The invoice I created has a max allowed number of 40 items which I can add to the invoice and all the automation on weights, prices etc. all work including the dynamic filter of only the items selected (non-blank rows) go onto the invoice and any blanks up to a total of 40 items simply do not appear on the printable and viewed page until I select a new item from my table select item.
Now I've tried copying and writing the auto clear code a few times and I've searched online for how to make it work but I can only find the explanation for one invoice in a worksheet. I have tried opening a second module and trying my best with various tries, but I'm getting nowhere. I do have xl2bb downloaded too but there isn't an option for me in this post to upload the mini sheet.
I should add that I need to create 2 more Macro buttons after this is fixed. one to save the invoice as a PDF and one to export most but not all of the data to create a separate copy PDF invoice that will look different. hopefully that won't be too hard, but one step at a time.
 
Upvote 0
Hi

I have been trying for the last 2 days to auto-clear a complex new invoice that I have created this week. My workbook already contains a working basic invoice for clients which is linked to an address table on another sheet. The 1st Invoice has 2 Macro buttons which was done last year, the 1st to clear the invoice and increment the invoice number, the 2nd to save the invoice as a PDF version. so that works all great. what I've had to do this year is create a shipping commercial invoice which I have now linked via dropdown and code to auto populate the client details from the same table i created last year, so that part works fine. I've also created a new items table which also auto sorts as I add more and more items to that table (in time I expect that table of items list to be many hundreds of items long!) The invoice I created has a max allowed number of 40 items which I can add to the invoice and all the automation on weights, prices etc. all work including the dynamic filter of only the items selected (non blank rows) go onto the invoice and any blanks up to a total of 40 items simply do not appear on the printable and viewed page until I select a new item from my table select item.
Now I've tried copying and writing the auto clear code a few times and I've searched online for how to make it work but I can only find the explanation for one invoice in a worksheet. I have tried opening a second module and trying my best with various tries, but I'm getting nowhere. I do have xl2bb downloaded too but there isn't an option for me in this post to upload the mini sheet.
Invoicing Database.xlsm
ABCDEFGHIK
1 INVOICE
2
3DATE:
4
5SHIPPER / SENDERCONSIGNEE / RECEIVER
6NAMENAMEAlan Imports LTD
7ADDRESSADDRESSLU 407, 1 Filament walk
8Wandsworth
9London
10POST CODEPOST CODESW18 4GQ
11TEL:TEL:
12COUNTRYCOUNTRY
13
14
15AIRWAY TRACKING CURRENCYGBP
16
17 COUNTRY OF ORIGIN HARM. CODE# OF UNITSCOST PER UNITITEM WEIGHTTOTAL VALUE
18ITEM, DESCRIPTION & INGREDIENTS
19Weight Amount
21GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
22Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
23GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
24Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
25GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
26Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
27VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
28Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
29GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
30Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
31VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
32Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
33VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
34Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
35VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
36Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
37VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
38Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
39VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
40Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
41VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
42Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
43VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
44Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
45VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
46Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
47VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
48Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
49VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
50Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
51VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
52Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
53VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
54Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
55VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
56Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
57VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
58Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
59VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
60Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
61VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
62Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
63VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
64Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
65VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
66Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
67GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
68Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
69GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
70Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
71GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
72Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
73GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
74Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
75GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
76Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
77VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
78Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
79VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
80Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
81GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
82Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
83RICE NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
84Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
85GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
86Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
87VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
88Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
89GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
90Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
91RICE NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
92Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
93VERMICELLI NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
94Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
95RICE NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
96Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
97RICE NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
98Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
99GLASS NOODLES (with sauce & seasoning)Thailand1902.3010.306£1.0050 gr300 gr£6.00
100Rice flour, concentrated sauce sachet, seasoning sachet, dried chilli powder, dried garlic flakes, (DOES NOT CONTAIN MEAT)
101
102
103EORI: GB082654205000Total number of items240INVOICE TOTAL£240.00
104SHIPPING TERMS: DDP
105REASON FOR EXPORT: PERSONAL HOME DOMESTIC USE ONLY
106Net Total Weight12.00 Kg
107Box 1 Size:
108Box 2 Size:
109Box 3 Size:
110
111DECLARATION STATEMENTSHIPPER SIGNATURE
112I hereby certify that the information in this invoice is true and correct as presented to us by the receiver and that the content descriptions and values of this shipment are as stated above and are for home use and personal consumption only and not for resale. 
113
114
115
CREATE INVOICES
Cell Formulas
RangeFormula
E7E7=IFNA(VLOOKUP($E$6,Cust_list,2,0),"")
E8E8=IFNA(VLOOKUP($E$6,Cust_list,3,0),"")
E9E9=IFNA(VLOOKUP($E$6,Cust_list,4,0),"")
E10E10=IFNA(VLOOKUP($E$6,Cust_list,5,0),"")
H21,H23,H25,H27,H29,H31,H33,H35,H37,H39,H41,H43,H45,H47,H49,H51,H53,H55,H57,H59,H61,H63,H65,H67,H69,H71,H73,H75,H77,H79,H81,H83,H85,H87,H89,H91,H93,H95,H97,H99H21=IF(E21="","",G21*E21)
I21,I23,I25,I27,I29,I31,I33,I35,I37,I39,I41,I43,I45,I47,I49,I51,I53,I55,I57,I59,I61,I63,I65,I67,I69,I71,I73,I75,I77,I79,I81,I83,I85,I87,I89,I91,I93,I95,I97,I99I21=IF(E21="","",E21*F21)
C21,C23,C25,C27,C29,C31,C33,C35,C37,C39,C41,C43,C45,C47,C49,C51,C53,C55,C57,C59,C61,C63,C65,C67,C69,C71,C73,C75,C77,C79,C81,C83,C85,C87,C89,C91,C93,C95,C97,C99C21=IF(B21="","","Thailand")
D21,D23,D25,D27,D29,D31,D33,D35,D37,D39,D41,D43,D45,D47,D49,D51,D53,D55,D57,D59,D61,D63,D65,D67,D69,D71,D73,D75,D77,D79,D81,D83,D85,D87,D89,D91,D93,D95,D97,D99D21=IFNA(VLOOKUP(B21,Item_List2,5,0),"")
B22,B100,B98,B96,B94,B92,B90,B88,B86,B84,B82,B80,B78,B76,B74,B72,B70,B68,B66,B64,B62,B60,B58,B56,B54,B52,B50,B48,B46,B44,B42,B40,B38,B36,B34,B32,B30,B28,B26,B24B22=IFNA(VLOOKUP(B21,Item_List2,3,0),"")
E103,I103E103=SUM(E20:E100)
I106I106=(SUBTOTAL(9,H20:H100)/1000)
D112D112=IF(B6="","",B6)
Named Ranges
NameRefers ToCells
Item_List='Items List'!$A$2:$E$6B22, B24, B26, B28, B30, B32, B34, B36, B38, B40, B42, B44, B46, B48, B50, B52, B54, B56, B58, B60, B62, B64, B66, B68, B70, B72, B74, B76, B78, B80, B82, B84, B86, B88, B90, B92, B94, B96, B98, B100
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A6Expression=IF(ISBLANK(B6),TRUE)textNO
A3Expression=IF(ISBLANK(B3),TRUE)textNO
G20:G21,G23,G25,G27,G29,G31,G33,G35,G37,G39,G41,G43,G45,G47,G49,G51,G53,G55,G57,G59,G61,G63,G65,G67,G69,G71,G73,G75,G77,G79,G81,G83,G85,G87,G89,G91,G93,G95,G97,G99Cell Value<1textNO
F20:F21,F23,F25,F27,F29,F31,F33,F35,F37,F39,F41,F43,F45,F47,F49,F51,F53,F55,F57,F59,F61,F63,F65,F67,F69,F71,F73,F75,F77,F79,F81,F83,F85,F87,F89,F91,F93,F95,F97,F99Cell Value<0.01textNO
Cells with Data Validation
CellAllowCriteria
E6:I6List='Customer database'!$A$2:$A$1258
B21List='Items List'!$A$2:$A$6
B77List='Items List'!$A$2:$A$6
B23List='Items List'!$A$2:$A$6
B25List='Items List'!$A$2:$A$6
B53List='Items List'!$A$2:$A$6
B55List='Items List'!$A$2:$A$6
B57List='Items List'!$A$2:$A$6
B79List='Items List'!$A$2:$A$6
B81List='Items List'!$A$2:$A$6
B83List='Items List'!$A$2:$A$6
B85List='Items List'!$A$2:$A$6
B87List='Items List'!$A$2:$A$6
B89List='Items List'!$A$2:$A$6
B91List='Items List'!$A$2:$A$6
B93List='Items List'!$A$2:$A$6
B95List='Items List'!$A$2:$A$6
B97List='Items List'!$A$2:$A$6
B27List='Items List'!$A$2:$A$6
B29List='Items List'!$A$2:$A$6
B31List='Items List'!$A$2:$A$6
B33List='Items List'!$A$2:$A$6
B35List='Items List'!$A$2:$A$6
B37List='Items List'!$A$2:$A$6
B39List='Items List'!$A$2:$A$6
B41List='Items List'!$A$2:$A$6
B43List='Items List'!$A$2:$A$6
B45List='Items List'!$A$2:$A$6
B47List='Items List'!$A$2:$A$6
B49List='Items List'!$A$2:$A$6
B51List='Items List'!$A$2:$A$6
B59List='Items List'!$A$2:$A$6
B61List='Items List'!$A$2:$A$6
B63List='Items List'!$A$2:$A$6
B65List='Items List'!$A$2:$A$6
B67List='Items List'!$A$2:$A$6
B99List='Items List'!$A$2:$A$6
B71List='Items List'!$A$2:$A$6
B73List='Items List'!$A$2:$A$6
B75List='Items List'!$A$2:$A$6
B69List='Items List'!$A$2:$A$6
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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