Excel Solver VBA, Multiple dynamic input.

Hightwalker

New Member
Joined
Jul 27, 2017
Messages
1
Hi there, I’m using the solver add-in for excel, I’m using it to optimize problem. However I’m running my head against a wall.

I must say I’m no pro at excel, so it might be a simple question, but I’ve searched the net for hours now, so I hope you can help me.

The variables set in ByChange needs to be something like:
HTML:
SolverOk SetCell:="$A$8", MaxMinVal:=2, ValueOf:="0", ByChange:="$B$4”:”$B$12”, “$C$4”
The problem is that “$B$12” can and will change all depending on another factor (nRow) that is including in the solving progress.

I have then been using this:
HTML:
ByChange:= .Range(Cells(4 , 2) , Cells(4+nRow , 2).Address
But with this I cant seem to add cell “C4” to the list of variables, it keeps making an error and wont run my VBA Script.

I Hope you can help me.
Thank you very much

Best regards
Peter Hansen
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi Peter and welcome to MrExcel Board!

Try this:
ByChange:=Union(Range("B2:B" & 4 + nRow), Range("C4")).Address

Regards
 
Upvote 0

Forum statistics

Threads
1,214,654
Messages
6,120,758
Members
448,991
Latest member
Hanakoro

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