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

DreyFox

New Member
Joined
Nov 25, 2020
Messages
44
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!
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Watch MrExcel Video

Forum statistics

Threads
1,127,855
Messages
5,627,269
Members
416,236
Latest member
Lynchbox

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
Top