View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Pops Jackson Pops Jackson is offline
external usenet poster
 
Posts: 64
Default Moving ranges as input for Solver

You are welcome. I am always happy to help.

Jim
--
Pops Jackson


"Kragelund" wrote:

Wonderful, Pops, thanks for your help,

rgds

Henrik Kragelund

"Pops Jackson" skrev:

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


"Kragelund" wrote:

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!