Using INDIRECT in VBA for Goal Seek

JV0710

Active Member
Joined
Oct 26, 2006
Messages
358
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
 

JV0710

Active Member
Joined
Oct 26, 2006
Messages
358
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
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

StephenCrump

MrExcel MVP
Joined
Sep 18, 2013
Messages
4,124
Office Version
  1. 365
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,795
Messages
5,638,370
Members
417,023
Latest member
Zimbo38

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
Top