How to automate solver using loop function

Copper Contributor

Hi all, I try to use Solver in Microsoft Excel 365 to match the total molecular weight with linear combination of molecular weight of components. Since I have total 1000 rows, and I need to use Solver for each row, I want to know how could I use For loop or other options to automate Solver in Excel. My VBA code for single run of Solver ($AT$9 only) is below:






And my Excel work sheet snapshot is below



I try to use the following VBA code to automate but failed.






How could I do this automatically from $AT$9 to $AT$1008? I am a newbie on VBA, and find the learning curve quite steep for myself. Thanks for your help!


0 Replies