View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default HELP! Problem with combinations

Sub AAA()
Dim i As Double, j As Double, k As Double
Dim l As Long
i = 1
j = 1.5
k = 2
l = 2
Do While Application.Round(i, 1) <= 2
Do While Application.Round(j, 1) <= 5
Do While Application.Round(k, 1) <= 4
Cells(l, 1) = i
Cells(l, 2) = j
Cells(l, 3) = k
Cells(l, 4) = i + j + k
Debug.Print l, i, j, k, i + j + k
k = k + 0.1
l = l + 1
Loop
k = 2
j = j + 0.1
Loop
j = 1.5
i = i + 0.1
Loop

End Sub

--
Regards,
Tom Ogilvy

"highjumper" wrote
in message ...

Hi all,

i have a problem that goes like this;

Q = Q1 + Q2 + Q3, where Q is constant

Q1 is between 1 and 2. Q2 is between 1.5 and 5. Q3 is between 2 and 4.
All values at Intervals of 0.1 (ie. Q1 = 1, 1.1, 1.2, ... 2)

i need to generate all combinations of values of Q1, Q2 and Q3 such
that the above relationship is satisfied.

Are that any kind souls that can help me with this?
Thanks in advance !!!
:)


--
highjumper
------------------------------------------------------------------------
highjumper's Profile:

http://www.excelforum.com/member.php...o&userid=26516
View this thread: http://www.excelforum.com/showthread...hreadid=397849