Microsoft Visual Basic Error 400

khwaja

New Member
Joined
Aug 19, 2005
Messages
14
I am using the following code to automate goal seek with an assigned button. Each time I tried to run it I get an error with big red X with 400. Any idea how to fix this?

Sub GoalSeek1_Click()
Range("E22").GoalSeek Goal:=Range("6000").Value, ChangingCell:=Range("D6")
End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
This is an invalid range reference. You are missing the column part of the cell address.
Range("6000")
 
Upvote 0
Thanks a lot for your time. I have now updated the formula as under to get the value from a cell. I have amended it a bit.

Sub GoalSeek1_Click()
Range("E22").GoalSeek Goal:=Range("B22").Value, ChangingCell:=Range("D6")
End Sub

But I run it I get runtime error 1004 Reference isn't valid.
 
Upvote 0
Sorry, I hae been away for a few days.

Can you provide me with what is in cells E22, B22, and D6?
 
Upvote 0
Not a problem at all. Appreciate you coming back. I think you are very clever because you knew what silly users like are usually up to. As you probably expected, I had the wrong cell refs. It is now working well. Very grateful and apologies for wasting your time.
 
Upvote 0
You are welcome. Glad you got it all figured it out.
:)
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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