New to VBA! Goal seek macro with a variable cell reference

MichaelS94

Board Regular
Joined
Aug 26, 2014
Messages
59
Hi,

I'm trying to write a relatively basic macro to run a goal seek function:

Range(G24).GoalSeek Goal:=0, ChangingCell:=Range("E17")



The only complexity is that I would like the "G24" to be variable.

So the row which the range() of the goal seek references (row 24 in this case) should be 20 rows below Cell E14 (which has a value of 4 in this case). Hence the G24.

Basically I want to be able to adjust E14 from say 4 to 10, and have the goal seek macro use G30 instead of G24.

Is this possible?

Thanks!!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,224,271
Messages
6,177,611
Members
452,785
Latest member
3110vba

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