Forum Discussion
VBA code
Hi,
I have an excel sheet (attached)that generates delivery reports based on the Delivery nr. entered. The information on the delivery note is pulled from a source table that has all the data. After entering a delivery note nr. in cell E7, I have to "Select All" in the description column then deselect the hyphen so as to have a neat report without the blank rows.
I would like to be assisted with;
1. a code that will do above in one click. If possible, after "selecting all and deselecting the hyphen, the code to print preview.
2. Is there a possibility of generating multiple delivery reports from an excel table with data.At the moment, I can only enter one delivery note number at time.
Thanks.
I attached an example that may give you some ideas. I added a worksheet with a structured table to list the delivery numbers to include in a "batch processing" function. The filter and print preview is triggered by the worksheet change event handler. Then, there is a button that triggers the batch processing, which will get the delivery numbers from the table on Sheet2, then pass them to the Delivery Note worksheet, which will change the value in the delivery number cell and trigger the change event handler.
So, you should be able to input a delivery number yourself, or run a batch.
6 Replies
- JMB17Bronze Contributor
I attached an example that may give you some ideas. I added a worksheet with a structured table to list the delivery numbers to include in a "batch processing" function. The filter and print preview is triggered by the worksheet change event handler. Then, there is a button that triggers the batch processing, which will get the delivery numbers from the table on Sheet2, then pass them to the Delivery Note worksheet, which will change the value in the delivery number cell and trigger the change event handler.
So, you should be able to input a delivery number yourself, or run a batch.
- A_SIRATIron ContributorThank you JMB17 ! This has really simplified my work.
- A_SIRATIron Contributor
Hi JMB17,
I modified the excel file to reflect what I really want in your original file and it worked perfectly. However, after coping the code to my other workbook, I got below error. I am not good with VBA but I think the sheet names could be bringing the error. Please assist.