I need to calculate goalseek for a range of data, and i have created a module to run the calculation. I also created a userform so I can input the variables.
what code should I put for command button so when I click the PO calculation button, it will run the goal seek function with those 3 variables? Thanks
Sub CheckGoalSeek()
Load UserForm1
UserForm1.Show
Dim i&, r As Range
On Error Resume Next
For i = 3 To 30
Set r = Range(UserForm1.TargetMOH.Text & i)
If r.Value = 0 Then
Resume Next
Else
r.goalseek Goal:=UserForm1.MOH.Value, _
ChangingCell:=Range(UserForm1.Adjustment.Text & i)
IF_FUNCTION
End If
Next
On Error GoTo 0
End Sub
what code should I put for command button so when I click the PO calculation button, it will run the goal seek function with those 3 variables? Thanks
Sub CheckGoalSeek()
Load UserForm1
UserForm1.Show
Dim i&, r As Range
On Error Resume Next
For i = 3 To 30
Set r = Range(UserForm1.TargetMOH.Text & i)
If r.Value = 0 Then
Resume Next
Else
r.goalseek Goal:=UserForm1.MOH.Value, _
ChangingCell:=Range(UserForm1.Adjustment.Text & i)
IF_FUNCTION
End If
Next
On Error GoTo 0
End Sub