InOverMyH3ad
New Member
- Joined
- Sep 17, 2018
- Messages
- 13
- Office Version
- 365
- Platform
- Windows
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!
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