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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Damon Ostrander

MrExcel MVP
Joined
Feb 17, 2002
Messages
4,239
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
 

Khameron

New Member
Joined
Jul 20, 2007
Messages
2
Thanks

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

Forum statistics

Threads
1,181,647
Messages
5,931,209
Members
436,784
Latest member
amuljono

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