MACRO HElp - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

MACRO HElp

DWDuckDWDuck Posts: 31Member
Good day I want to do multiple Goalseeks at the same time by clicking on a button in excel.

Ok basically this is wat it currently looks like and I need to know whats wrong:

the first few cells are cell were I set my goalseeking parameters

this is my code, can someone fix it or tell me why it won't work as there is no error just nothing happens when it's performed.


Sub PERF_GOALSEEK()
Dim Start As Integer
Dim TheEnd As Integer
Dim X As Integer
Dim SR As Integer
Dim CR As Integer
Dim VALS As Double

If (Sheet1.Cells(1, 2).Value <> Null) And (Sheet1.Cells(2, 2).Value <> Null) And (Sheet1.Cells(3, 2).Value <> Null) And (Sheet1.Cells(4, 2).Value <> Null) And (Sheet1.Cells(5, 2).Value <> Null) Then


Start = Sheet1.Cells(1, 2).Value
TheEnd = Sheet1.Cells(2, 2).Value
SR = Sheet1.Cells(3, 2).Value
VALS = Sheet1.Cells(4, 2).Value
CR = Sheet1.Cells(5, 2).Value


For X = Start To TheEnd
Cells(X, CR).GoalSeek Goal:=VALS, ChangingCell:=Cells(X, SR)
Next X

End If
End sub
Darkwing Duck aka DWduck signing off :)
Sign In or Register to comment.