How do I get Excel VBA (with Solver) to choose the best value

DreyFox

Board Regular
Joined
Nov 25, 2020
Messages
61
Office Version
  1. 2016
Platform
  1. Windows
Good morning/afternoon!

So I have a little problem. I have a large data set shown below:
1607530367111.png

And the following fields, where "Drilled Hole Volume" and ""Volume of Bolt" remain unchanged and static. The only field changing here is the "Volume of Cartridge". Basically I'd like some sort of VBA code or macro that can choose a maximum of two cartridges that when they populate the field "Volume of Cartridge", the field "Remaining Volume" gets as close as possible to 0. Once that is done, I'd like it to select those options in the ListBoxes. So, assume I selected 25 mm Dia x 12" and 28 mm Dia x 24", then it would look like the following:
1607530691822.png

Any help would be greatly appreciated. If needed, I can attach the Excel sheet! Thank you so much!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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