Thank You for reply.
this is the original code which is working fine and i have only added an for loop to get value from a 2D array instead of columns. and i tried the code as suggested which giving is me error for Goal Seek
Sub multi_guess_and_test()
Dim ws_input As Worksheet
Dim num_rows
Set ws_input = ThisWorkbook.Worksheets("Input")
num_rows = ws_input.Cells(ws_input.Rows.Count, 1).End(xlUp).Row
Dim i
Dim set_cell_range As Range, to_value_range As Range, changing_cell_range As Range
Dim to_value_val
Dim temp_val
Dim temp_range As Range
For i = 2 To num_rows 'i starts at 2 because we assume 1st row is label
Set set_cell_range = Range(ws_input.Cells(i, 1).Formula)
On Error Resume Next
Set to_value_range = Range(ws_input.Cells(i, 2).Formula)
If Err.Number <> 0 Then
to_value_val = ws_input.Cells(i, 2).Value 'find the value of cell. Even if the cell is a formula, it is ok! (Originally, goal Seek does not allow this cell to be a formula.)
End If
On Error GoTo 0
Set changing_cell_range = Range(ws_input.Cells(i, 3).Formula)
'now that all the inputs are set, perform goal seek operation
set_cell_range.GoalSeek _
Goal:=to_value_val, _
ChangingCell:=changing_cell_range
Next 'onto the next calculation!
End Sub
Bookmarks