PC Review


Reply
Thread Tools Rate Thread

Automatically run macro

 
 
michael.dellaccio@gmail.com
Guest
Posts: n/a
 
      2nd Oct 2007
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?=
Guest
Posts: n/a
 
      3rd Oct 2007
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
>
>

 
Reply With Quote
 
michael.dellaccio@gmail.com
Guest
Posts: n/a
 
      3rd Oct 2007
No i haven't. Whats a Worksheet_Change event?

 
Reply With Quote
 
=?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?=
Guest
Posts: n/a
 
      4th Oct 2007
The link in my first reply explains it.
--
HTH,
Barb Reinhardt



"(E-Mail Removed)" wrote:

> No i haven't. Whats a Worksheet_Change event?
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
automatically executing Excel macro after OutputTo macro I.M. Shatner Microsoft Access Macros 0 6th Aug 2009 05:18 PM
automatically run a macro 42410 Microsoft Excel Discussion 6 26th Apr 2005 03:29 PM
Automatically Run Macro Jane Microsoft Access Macros 1 9th Aug 2004 10:30 PM
Run Macro Automatically Alex Microsoft Access Macros 1 14th Apr 2004 09:30 PM
is it possible to run a macro automatically? shirley Microsoft Excel Programming 2 10th Feb 2004 09:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:25 PM.