MACRO HElp - Programmers Heaven

Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.


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.

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.