View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Cavy Cavy is offline
external usenet poster
 
Posts: 13
Default Using Goal Seek without a macro

LCA,

You will have to write the following in the Cash Flows sheet code (not in a
module)

Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("Cash Flow").Range("D35").GoalSeek Goal:=0,
ChangingCell:=Sheets("Cash Flow").Range("B34")
End Sub


"LCA" wrote:

if any cell in my workbook changes, what VBA code do I need to get goal seek
to run automatically without calling a macro? I do not want my users to have
to call a macro but rather just put in their inputs in any other cells and
have goal seek automatically calculate. This is what I have so far - what am
I missing?

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
Sheets("Cash Flow").Select
Range("d35").GoalSeek Goal:=0#, ChangingCell:=Range("b34")
End Sub