link goal with excel in goal seek macro

Dolf

New Member
Joined
Apr 3, 2007
Messages
16
Hello,
I recorded a macro for a goal seek and goal cell and variable input I can link to excel, however if I want to change the goal value, I have to go into the macro and change it there.
Tried to name the goal cell and enter that in the macro, but that doesn't work.
Anyone has a solution?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hello Dolf,

It would be easier to solve your issue if you post your code. However, I have just set the below example for you perhaps it clarifies things out

Code:
Sub Macro1()

Dim Goal_Value As Double
Goal_Value = ActiveSheet.Range("A1").Value ' Change this to the desired sheet/cell reference

Range("C6").GoalSeek Goal:=Goal_Value, ChangingCell:=Range("C4")

End Sub
 
Last edited:
Upvote 0
Great .. I am glad I could help & thanks for reporting back :)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top