ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Goal Seek without a macro (https://www.excelbanter.com/excel-programming/391534-using-goal-seek-without-macro.html)

LCA

Using Goal Seek without a macro
 
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



Cavy

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




All times are GMT +1. The time now is 11:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com