Goal Seek Macro

Greg Determann

New Member
Joined
Jan 18, 2005
Messages
20
I am just getting my feet wet in VBA and have a question.

I am trying to figure out how to write a macro that will look at cell C3 and C4 and determine which one is lower. If c3 is lower, then set it to a value of 0 by changing cell c2 and then move onto the next column. Eventually, the number in row 4 will be smaler than the row 3 value. At that pt I need it to goal seek to set the row 4 number to zero by still changing the corresponding row 2 value. After that, it is finished. Any ideas?
 

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.

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Greg,

just getting your feet wet?
then take it step by step

let's first try to compare two cells
my question to you : can c3 = c4 ?

Code:
Sub Macro1()
If Range("C3") < Range("C4") Then MsgBox Range("C3") & " < " & Range("C4")
End Sub

can you make this work?
try then to make some variations on this theme...

kind regards,
Erik
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Fine, Greg,

Perhaps some people were busy to help you or others will come back for the solution. So please post how you solved this.

kind regards,
Erik
 

Forum statistics

Threads
1,181,896
Messages
5,932,676
Members
436,850
Latest member
Jasperlee93

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