Hi Hans
The solution calls for them to remain separate, the one is a count sheet, and the other a recon sheet.
Staff can cheat if the are in the same workbook.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi All
I have recorded a macro to do the following, but it doesn't look neat and creates format issues with unsightly cell data in two columns. Can you possibly assist.
Workbook name = STOCK TAKE AUTOMATION TEMPLATE
The above is the main sheet. VBA should function in the following sequence. The range is Column E3, up to line E78.
(Step 1) If cell E3 has a value, then the value should be deleted and a VLOOKUP formula should be inserted. The lookup value is from Column B.
The reference/table is Column B-D in the below workbook. I have the code already that opens that workbook, so it will be visible. The return value is from below column D. See below workbook. This should only be done If range of cells E3 to E78 in STOCK TAKE AUTOMATION TEMPLATE has a value, otherwise nothing should be done.
Workbook name = VARIANCE RECOUNT 2 TEMPLATE
(Step 2) If cells in column G of STOCK TAKE AUTOMATION TEMPLATE has a value, then the value should be deleted, and formula =E3-F3 should be inserted.
I have recorded a macro myself doing the steps, and it works, but the rows with no data, in the range column E & G then has zero values, which creates a problem when I do a print to PDF. See below. So the macro and the way I have approached it works, but the result leaves unsightly cells with formulas included in the PDF print which I would like to avoid, See below.
The end result should look like this:
Any assistance will be greatly appreciated.
Regards
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Hi Hans
The solution calls for them to remain separate, the one is a count sheet, and the other a recon sheet.
Staff can cheat if the are in the same workbook.
What is the exact name of the STOCK TAKE AUTOMATION TEMPLATE workbook?
Hi Hans
See path of each workbook below:
The main workbook = "S:\WAREHOUSE FILES\WAREHOUSE STOCK TAKES\STOCK TAKE AUTOMATION TEMPLATE.xlsm"
The template for the count = "S:\WAREHOUSE FILES\WAREHOUSE STOCK TAKES\VARIANCE RECOUNT 2 TEMPLATE.xlsm"
And both have a sheet called "VARIANCE RECOUNT 2"
Hope this helps.
Thanks. So it should be
Set wst = Workbooks("STOCK TAKE AUTOMATION TEMPLATE.xlsm").Worksheets("VARIANCE RECOUNT 2")
And the line
wst.Range("E" & r).FormulaR1C1 = "=VLOOKUP(RC2, 'VARIANCE RECOUNT 2 TEMPLATE'!C2:C4, 3, FALSE)"
should become
wst.Range("E" & r).FormulaR1C1 = "=VLOOKUP(RC2, '[VARIANCE RECOUNT 2 TEMPLATE.xlsm]VARIANCE RECOUNT 2'!C2:C4, 3, FALSE)"