Moving ranges as input for Solver

G

Guest

I have the following problem in Excel 2002:
I want a Solver makro to perform an optimisation over a range, which is
indirectly determined by the user input. This means: if the user states he is
35 years old, I want Solver to specify a calculation on a range which will
then be e.g. 65-35=30 columns wide, starting for instance from cell A2. Since
I can't tell Solver that cell A2+30 = cell AE2, what can I do instead to get
Solver to include the correct number of cells??

Any help would be greatly appreciated!
 
G

Guest

Assuming A2 = 65 (Retirement Age)
A3 = 35 (Variable Age)

This will Select the desired range. Maybe this
will be enough for you to complete the task.
Let me know if you need more help.

Sub Findit()
Dim rng As Range
x = Range("A2").Value
y = Range("A3").Value
With Cells
Range("A2").Activate
Set rng = .Range(.Cells(2, 1), .Cells(2, x - y + 1))
rng.Select
End With
End Sub

Best wishes,

Pops Jackson
 
G

Guest

Wonderful, Pops, thanks for your help,

rgds

Henrik Kragelund

"Pops Jackson" skrev:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top