Hi,

I'm new to VBA or macros. I am trying to solve multiple cells in which the inputs also changes. Following is the recorded Macros.

Sub AxialShear()
'
' AxialShear Macro
'

'
    Range("D3").Select
    ActiveCell.FormulaR1C1 = "=RC[16]"
    Range("G4").Select
    ActiveCell.FormulaR1C1 = "=R[-1]C[14]"
    Range("B2").Select
    ActiveCell.FormulaR1C1 = "30"
    Range("B2").Select
    SolverOk SetCell:="$B$25", MaxMinVal:=2, ValueOf:=0, ByChange:="$B$2", Engine:= _
        1, EngineDesc:="GRG Nonlinear"
    SolverOk SetCell:="$B$25", MaxMinVal:=2, ValueOf:=0, ByChange:="$B$2", Engine:= _
        1, EngineDesc:="GRG Nonlinear"
    SolverSolve
    Selection.Copy
    Range("W3").Select
    ActiveSheet.Paste
End Sub
I wanted the loop to change the values of D3 and G4 by assigning T3-T28 into D3 and U3-U28 into G4. Once the input is changed, I want to solve so that cell B2 minimum by setting B25>= B26 and B39<=B40. The variables that cells that are fixed are B2, B25, B26, B39, and B40 while the one that are changing are T3-T28 and U3-U28 which will be assigned into D3 and G4. I apologize if this isn't to clear.

I appreciate your help.