Named cell range referenced in Solver VBA call

Khameron

New Member
Joined
Jul 20, 2007
Messages
2
I am trying to reproduce a data sheet from an outside source in my own project. The sheet contains VBA code which references solver. I have been able to transcribe most of the sheet into my own project save for the part of the code that references the range of cells used in the solver. The range is a named cell or group of cells, I am not sure. I am not too familiar with solver or with naming cells and I haven't been able to figure out how or where this line of code references from. The code is as follows:

If ActiveSheet.Optslip = True Then
SolverLoad loadArea:=Range("SolveCH4")
SolverSolve userFinish:=True
End If
If ActiveSheet.OptATE = True Then
SolverLoad loadArea:=Range("SolveATE")
SolverSolve userFinish:=True
End If

It is the "SolveCH4" and "SolveATE" that I have not been able to find anywhere on the sheet.
Question is:
Is it possible to name a wide disjointed range of cells for reference to solver in VBA?
Additionally, is there a way of locating this range of cells in the sheet, using find or something like that?

Thanks a lot for any help you can offer.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi Khameron,

I'm not sure about the disjointed range question, but I doubt that Solver can handle it. It shouldn't be difficult to try it and see, though.

Regarding viewing the range, you can often find the named range by simply checking the Name box (the dropdown just above cell A1). If the name is there, selecting it should cause the corresponding range to be selected. But sometimes names aren't displayed there. If names are defined using Insert > Name > Define, they don't show up in the Names box, but do show up in the Names dialog that results from Insert > Name > Define.

But another easy way to do it is to go to the Visual Basic Editor and in the Immediate pane enter, for example,

Range("SolveATE").Select

(if you don't have an Immediate pane, go to the View menu in the VBE and turn it on).

Keep Excelling.

Damon
 
Upvote 0
Thanks

Thanks alot for your help Damon.
Immediate window makes it really easy. I've never really used it before
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,809
Members
449,048
Latest member
greyangel23

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