• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Goal Seek using Macro

webmax

Member
Hi

I am attaching the same excel file in that i make cell C8 as Zero by changing E8 Column

For that i have to change from C8 to C22 cell as Zero by Changing the E8 to E22

I Need the macro
 

Attachments

  • test.xlsx
    9.4 KB · Views: 7
Webmax

Firstly The logic above does not make sense

C8: =A8+B8 has no connection to E8
A8 and B8 are both values

What is F8 ?

If you want C8 to be zero which of A8 or B8 do you want changed ?

If you want to make C8 = 0 by changing B8 use the following:
Code:
For i = 8 To 22
  Range("C" & i).GoalSeek Goal:=0, ChangingCell:=Range("B" & i)
Next

If you want to make C8 = 0 by changing A8 use the following:
Code:
For i = 8 To 22
  Range("C" & i).GoalSeek Goal:=0, ChangingCell:=Range("A" & i)
Next

Can you please clarify your requirements
 
Last edited:
Back
Top