VBA Goal Seek with Moving Reference Cell

InOverMyH3ad

New Member
Joined
Sep 17, 2018
Messages
9
Hello All,
I have a simple goal seek code in a sheet. However, we frequently add rows above where this goal seek happens. The BJ column will always be the same, but the row number will change. Is there any way to have the cell reference change in the VBA as the sheet expands/contracts? I've searched online for help but it's hard to phrase exactly what I'm looking for and find valid results. Any assistance would be greatly appreciated!

Code:
Private Sub CommandButtonX_Click()
Range("BJ736").GoalSeek _
    Goal:=Range("BJ759"), _
    ChangingCell:=Range("BJ751")

End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Could/Can you possible assign Range Names to each GoalSeek element?

Here's a sample of a Macro I use in a GoalSeek environment I use Often.

Code:
Sub UpdateGoalSeek()
    Range("End_Bal").GoalSeek Goal:=0, ChangingCell:= _
        Range("CMP")
End Sub

In my case my elements don't Jump around the worksheet or change their cell locations, but still Range Names are by design suppose to assist in taking care of this situation if it exists.

FWIW...

Jim
 
Upvote 0

Forum statistics

Threads
1,215,412
Messages
6,124,761
Members
449,187
Latest member
hermansoa

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