View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] yves.mosselmans@gmail.com is offline
external usenet poster
 
Posts: 3
Default VBA to run all variable combinations in a calculation model and store result

Hi,

I received a workbook with a calculation model which calculates a price based on 6 different criteria and complex formulas. There are over 40,000 possible combinations, choosing different criteria.

I managed to create a table with all possible combinations. Criteria 1 is stored in Column A, Criteria 2 is stored in Column B, etc up to 6 columns. I can't use a formula for this.


Would it be possible to create a vba code to run all combinations in the calculation model and store the result in the last column?


A very simplified example could be (using 2 variables in 2 columns):

Col 1 (Month) Col 2 (Rateplan)
January Gold
February Silver
March
April
....

The calculation model could be
Month (data validation from Col 1)
Rateplan (data validation from Col 2)
Charge = formula that calculates the charge based on two above criteria


In this example a Combination could be January and Gold... I would like the macro to run this (and all other) combination in the calculation model and store the outcome as a value in Column 3 (next to the combination).


Could a vba wizzard help me with this?