Have you considered using a Worksheet_Change event?
http://www.ozgrid.com/VBA/run-macros-change.htm
--
HTH,
Barb Reinhardt
"(E-Mail Removed)" wrote:
> My name is Mike and i have a question about microsoft excel macro's.
> Attached is a copy of the excel sheet im working on. Below the excel
> sheet is the macro I built. Some of the cells contain given values and
> some cells are calculated from formulas. Cell (G4) is my given
> value...it is related to cell (C32). The point is, I plug a value into
> cell (C10) and it runs through the rest of the calcs in the other
> cells and gives me a value to cell (C32). I built a macro that works
> as a goal seek pretty much. The macro makes cell (C32) equal to cell
> (G4) and gives me the value for cell (C10). I want the macro to
> automatically run if i take a guess at (C10) and it gives me a value
> for (C32) not equal to (G4). And what would really help me out is if
> the guess can stay in col C and the right value goes in col D.
>
> Spray Noz Des Flow is cell (C10) and Tafter spray - Tsat is cell (C32)
>
> Increment 0.01 (G3)
> Value 25 (G4)
> Tolerence 0.1(G5)
>
>
> Spray Noz Des Flow % 27.05
> Spray Noz Des Flow lbs/hr 1,352,500
>
> Des Flow Upper Spray lbs/hr 450,833
> Des Flow Lower Spray lbs/hr 901,667
>
> UPPER SPRAY
>
> Went fsh lbs/hr 5,000,000
> Pent fsh psia 2500
>
> Wspray design lbs/hr 450,833
> h spray btu/lb 450.0
>
> Went upper spray lbs/hr 4,549,167
> Pent upper spray psia 2600
> Tent upper spray °F 900
> h ent upper spray btu/lb 1381.8
>
> h after design spray flow btu/lb 1297.8
> T after design spray flow °F 693
> Tsat °F 668
> Tafter spray - Tsat °F 25
>
>
> Macros
>
> Sub calculateSize()
> X = 0
> TOLERANCE = Cells(5, 7).Value
> Do While X < 101
> Cells(10, 3).Value = X
> RESULT = Cells(32, 3).Value - Cells(4, 7).Value
> If RESULT < TOLERANCE And RESULT > (-1 * TOLERANCE) Then
> X = 101
> Else
> X = X + Cells(3, 7).Value
> End If
> Loop
> End Sub
>
>