Relative Reference - Formula to Goal Seek Using Cell on Different Weooksheet

usermrex

New Member
Joined
Feb 6, 2012
Messages
14
I am using Excel 2010. I want to use a relative reference to goal seek using a "ChangingCell" that is in a different worksheet...

ActiveCell.GoalSeek Goal:=0, ChangingCell:=Sheets("Volumes").Range("O11")

... but I am getting an error message that the reference is not valid. What should I call the ChangingCell on the "Volumes" sheet so that it relates to the ActiveCell (which is Q23 on a sheet called "Results")?

Also, I would like the ChangingCell to also be relative in that it moves down rows as my original "Active Cell" moves down?

ie ActiveCell is "Results Q23" and ChangingCell is "Volumes O11", so if the ActiveCell is "Results Q24", the ChangingCell needs to be "Volumes O12".

Is this even possible? Thanks very much. :)
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try this - you can adjust the constants to suit your sheet, but you must run this from the Results sheet with the cell you want to goal seek on active.
Code:
Sub GoalSeekDynamic()
'run with Results sheet active
Const R As Long = 11 'start row on Volumes sheet
Const B As Long = 23 'start row on results sheet
Dim rw As Long, col As Long
rw = ActiveCell.Row
col = ActiveCell.Column
Cells(rw, col).GoalSeek goal:=0, changingcell:=Sheets("Volumes").Cells(R + rw - B, "O")
End Sub
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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