Hi, I would kindly like to ask for help, I don´t know how to write following thing.
I have 3 values A,B,C (A+B+C = 100 always) A,B,C dim as integer obviously.
Value A at first step will be set to 100, B = 0, C= 0.
I need to create loop with step decrementation by 1, so if A=99,B=1,C=0,
Next step A = 98, B = 1, C = 1 but I need every possible of combination so if A=97, B can be 0 or 1 or 2 or 3 and C can therefore be C = 3 or 2 or 1 or 0
It first I thought using something like:
For A = 100 to 0
For B = (100-A) to 0
For C = (100-A-B) to 0
like 3 For cycles, one in another, but I am not sure if this is the way, as I have very little experience with VBA and programming at all.
Every combination of numbers has to be inserted to formula and the result compared with other (This I can easily manage with if then statement). So the problem lies in writing this loop, for correctly assesing all the possible combinations).
If anybody could help me with that, I would be very grateful.
Thanks in advance
I have 3 values A,B,C (A+B+C = 100 always) A,B,C dim as integer obviously.
Value A at first step will be set to 100, B = 0, C= 0.
I need to create loop with step decrementation by 1, so if A=99,B=1,C=0,
Next step A = 98, B = 1, C = 1 but I need every possible of combination so if A=97, B can be 0 or 1 or 2 or 3 and C can therefore be C = 3 or 2 or 1 or 0
It first I thought using something like:
For A = 100 to 0
For B = (100-A) to 0
For C = (100-A-B) to 0
like 3 For cycles, one in another, but I am not sure if this is the way, as I have very little experience with VBA and programming at all.
Every combination of numbers has to be inserted to formula and the result compared with other (This I can easily manage with if then statement). So the problem lies in writing this loop, for correctly assesing all the possible combinations).
If anybody could help me with that, I would be very grateful.
Thanks in advance