Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Pc to fast/slow or something like that...

Hello. I am experiencing some problems in my Excel visual basic
project.

The project exists contains two macro´s.

macro1: Processcalculate() which calculates my workbook evertime it´s
executed.
macro2: LabelChange() This macro´s checks if a cellvalue is true or
false. If true, the colour of the label changes.

The case:

Everytime that macro1 is executed the value in cell B14 ascends until
it reaches the value 1.20.
After this execution the value must be checked (macro2) whether it is
true or false and change the colour or do nothing.

These macros works perfect.

Now there is one thing. The hole project must be dynamic.

The user can hit a cmdbutton which starts the project (which is a
simulation of an emptying vessel. This is build up out of a lot of
labels [#86]. Changer the colour, one by one, makes it look like it is
emptying.

This is the code of the button:
__________________________________________________ ____________
Private Sub Simulationstart_click()

Do Until Range("B14").Value 1.2
Call ProcessCalculate
Call Labelchange
Loop

End Sub
__________________________________________________ ____________
Sub ProcessCalculate()

N_0 = Cells(7, "K").Value
N_1 = Cells(6, "K").Value
N_2 = Cells(5, "K").Value
N_3 = Cells(4, "K").Value
N_4 = Cells(3, "K").Value

'=MAX($K$7-B17;0
H_0_0 = Application.WorksheetFunction.Max((N_0 - x_t_0), 0)
Cells(13, "C").Value = H_0_0

H_1_0 = Application.WorksheetFunction.Max((N_1 - x_t_0), 0)
Cells(13, "D").Value = H_1_0

H_2_0 = Application.WorksheetFunction.Max((N_2 - x_t_0), 0)
Cells(13, "E").Value = H_2_0

And lot´s more!!!
_________________________________________________
Sub Labelchange()

Dim y As Integer

For y = 1 To 86
If Range("B14").Value (y / 86) * 1.2 Then
Me.Controls("Label" & CStr(y - 1)).BackColor = vbBlack
Me.Controls("Label" & CStr(y - 1)).BorderColor = vbBlack
End If
Next y

End Sub
__________________________________________________ ____________

This seems to work almost.

The problem that seems to be happening is that after macro1 is
executed, it starts right again with macro1. like there isnt any time
to execute macro2. And then, at the end. when the value 1.2 is reached
all of the labels change their colors at once.

Does anyone has a suggestion to fix this?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runs fast then slow rpw Excel Programming 17 February 28th 07 10:32 PM
Fast then slow performance Daniel Bonallack Excel Programming 3 May 30th 06 10:40 PM
Searches slow for some Fast for others? [email protected] Excel Worksheet Functions 0 August 4th 05 08:54 PM
Why macro slow on one, fast on another? CLR Excel Programming 4 April 4th 05 01:09 PM
It was SLOW, now is FAST! Phillips Excel Programming 6 November 21st 03 10:21 PM


All times are GMT +1. The time now is 04:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"