Using INDIRECT in VBA for Goal Seek

JV0710

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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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,215,676
Messages
6,126,168
Members
449,296
Latest member
tinneytwin

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