Excel 5.0 Macro

I am trying to create a simple macro that runs a Goal Seek, but also displays an input box to allow the user to enter the proposed value.

Sub Goal_Seek()
Worksheets("Negotiation Scenario").Activate

myNum = Application.InputBox("Enter a number")
    ActiveCell.GoalSeek Goal:=myNum, ChangingCell:=ActiveCell.Offset(-2, 0). _
End Sub

The only result I get is that the reference is not valid.
I know I am probably way off mark but can anyone help?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Your code should work, provided that:

1. The active cell is the cell with a formula that you want to be equal to mynum.

2. The cell to change is the cell two steps above the active cell.

Perhaps you should specifically name the ranges where you want to do your goal seeking. Something like this:

Sub Goal_Seek()
  Worksheets("Negotiation Scenario").Activate
  myNum = Application.InputBox("Enter a number")
  Range("D9").GoalSeek Goal:=myNum, ChangingCell:=Range("D7")
End Sub

Ture Magnusson
Karlstad, Sweden

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kenny1Author Commented:
Thankyou very much.
I have been banging my head over this problem and getting no where.
I appreciate the help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.