Using INDIRECT in VBA for Goal Seek

JV0710

Active Member
Joined
Oct 26, 2006
Messages
440
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
Good Day All

Please can I get help with the following:

I am trying to do Goal Seek in VBA but I want to use the INDIRECT function to reference the cells and values

my recorded macro is as follows
*************************************************************************************
Sub mygoalseek()
'
' mygoalseek Macro
'

'
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
Range("D2").GoalSeek Goal:=52535, ChangingCell:=Range("D15")
End Sub
*****************************************************************************************
In cells K1, K2 and K3 I have cell Addresses refering to the goal seek parameters

Where I have Range("D2") in the Macro - I want to reference the cell address in K1
Where I have Goal:=52535 in the Macro - I want to reference the cell address in K2
Where I have ChangingCell:=Range("D15") in the Macro - I want to reference the cell address in K3

I think that using the INDIRECT function will be correct, but I do not know how to edit the macro accordingly

Thanks in advance for your help
 
Good Day Stephen

Just some feedback

File is working fine now. I re-wrote the whole thing from scratch and now it seems to be working. Don't know for sure what was wrong . but it's fine now

Thanks once again for your help
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
File is working fine now. I re-wrote the whole thing from scratch and now it seems to be working. Don't know for sure what was wrong . but it's fine now

Great, I'm glad you got it working. Thanks for posting back.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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