I am working with 2 cells that are both using data validation lists (cell B3 and B4 in the below). The list item chosen in each cell is used in a formula that outputs 2 results (one in C21 and the other in C22). What I am trying to do is present all iterations and their result in C21 and C22. How I have approached this is by looping through all data validation items in B4 and for each item in B4, loop through all options in B3.
There are 8 different options in B3 and 4 different options in B4. Using Offset, I am presenting the outputs of this in a separate tab called "Sensitivity Output" which I would expect to be a table 8 columns wide and 16 rows deep.
In addition to this, I am getting an error of "Object required" on the line "Set divRange = Evaluate(divCell.Validation.Formula1)"
Code below as presented which partially works but is not presenting the desired result at the moment.
I am new to VBA but as far as I understand this it should be working?
Thanks in advance for any help!
Sub Sensitivty()
'
' Sensitivty Macro
'
Dim ebitCell As Range
Dim ebitRange As Range
Dim c As Range
Set ebitCell = Sheets("Assumptions Input").Range("B3")
Set ebitRange = Evaluate(ebitCell.Validation.Formula1)
Dim divCell As Range
Dim divRange As Range
Dim d As Range
Set divCell = Sheets("Assumptions Input").Range("B4")
Set divRange = Evaluate(divCell.Validation.Formula1)
'Looping through items in B4
For Each d In divRange
divCell.Value = d.Value
'For each item in B4, loop through each of the items in B3
For Each c In ebitRange
ebitCell.Value = c.Value
Worksheets("Assumptions Input").Activate
Range("C21:C22").Select
Selection.Copy
Worksheets("Sensitivity Output").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Select
Next c
ActiveCell.Offset(2, -8).Select
Next d
Set ebitCell = Nothing
Set ebitRange = Nothing
Set divCell = Nothing
Set divRange = Nothing
End Sub