View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jimmy[_5_] jimmy[_5_] is offline
external usenet poster
 
Posts: 37
Default Execution very slow

Hi all,
The function:

Private Sub Worksheet_Change(ByVal Target As Range)

If Range("BJ1") <= Range("BI1") And Range("BK1") = 0 Then
MsgBox (Range("BH1").Value & " reach the minimum level")
Range("BK1") = 1
End If

If Range("BJ1") Range("BI1") Then Range("BK1") = 0

End Sub

BH1 is pointed to a cell contains text, BI1 and BJ1 are pointed to different
cells which do simple +/-. The above function is just for testing, there
will be about 50 items that I will use array and for loop if the testing is
ok.
To prevent the message prompt so many times, I have set the flag(BK1) keep
on 1 until "BJ1" "BI1" again. But I don't know why everytime a increment
in BJ1, the application is hang for about 10 seconds. Please help to point
out my mistake, thank you.