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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
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,214,942
Messages
6,122,366
Members
449,080
Latest member
Armadillos

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