Need vba to allow sheet formula to update before continuing

Pat_43

New Member
Joined
Aug 29, 2019
Messages
1
I’ve got a loop that puts an ID number into a cell and thencopies the results from another cell to an output sheet based on formula on thesheet, however the vba code doesn’t wait for the formula to update the results cells and so copies whatever was in the result cells at the start of the macrorunning.

My question is this – can I get the code to force the sheetformula to run and update the results cells before it copies the results to theoutput sheet? The calculate and wait options shown in the code below haven’thad the desired effect so far.

Code:
[SIZE=2][FONT=Arial][COLOR=#000000]    For Each DefectIDsIn OutRng[/COLOR][/FONT][/SIZE]
[SIZE=2][FONT=Arial][COLOR=#000000]    Debug.PrintDefectIDs.Value[/COLOR][/FONT][/SIZE]
[SIZE=2][FONT=Arial][COLOR=#000000]       Sheets("FAC Assigning tool").Range("C2").Value =DefectIDs[/COLOR][/FONT][/SIZE]
[SIZE=2][FONT=Arial][COLOR=#000000]        Calculate[/COLOR][/FONT][/SIZE]
[SIZE=2][FONT=Arial][COLOR=#000000]       Application.Wait (Now + TimeValue("00:00:01"))[/COLOR][/FONT][/SIZE]
[SIZE=2][FONT=Arial][COLOR=#000000]        CallFindAllFrequencies 'Checks defect ID against FACs and copies result to blankrows on Output sheet[/COLOR][/FONT][/SIZE]
[SIZE=2][FONT=Arial][COLOR=#000000]    Next DefectIDs[/COLOR][/FONT][/SIZE]
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Welcome to the MrExcel board!

Not sure if it will help but you could try the Statement DoEvents in place of your other two attempts.
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,046
Members
449,063
Latest member
ak94

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