View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
J_J[_2_] J_J[_2_] is offline
external usenet poster
 
Posts: 140
Default why does it sounds every minute?-Help please

Hi Bernie,

Yours and Tom's proposals achieved a solution of stopping
"false alarms" (beeps that occur because of the system clock minute changes
reflected by another macro). But now although there is no sound beeps on
minute changes, there is no sound either on changes with the watched range
display. Possibly I am missing something...or we all are.:)

Regards
J_J


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
J_J,

Try turning off events when you update your cell values:

Sub zaman()
Application.EnableEvents = False
Sheets("Sheet1").Range("A1").Value = Hour(Now())
Sheets("Sheet1").Range("B1").Value = Minute(Now())
Sheets("Sheet1").Range("C1").Value = Second(Now())
Application.EnableEvents = True
Nextzaman
End Sub

HTH,
Bernie
MS Excel MVP

"J_J" wrote in message
...
Hi Bob,

No...sadly the problem is still here with me.
It is not sounding as the cell displays change but it sounds in minute
intervals with the 'Nextzaman' module.
Here are the other codes from the workbook if it may help...

In Module1 I have this:
'------------------
Sub zaman()
Sheets("Sheet1").Range("A1").Value = Hour(Now())
Sheets("Sheet1").Range("B1").Value = Minute(Now())
Sheets("Sheet1").Range("C1").Value = Second(Now())
Nextzaman
End Sub
'-------------------------------
Private Sub Nextzaman()
Application.OnTime Now + TimeValue("00:01:00"), "zaman"
End Sub
'--------------------------

In Sheet1 code page I have your code

and in ThisWorkbook code page I have:

'--------------------
Private Sub Workbook_Open()
Application.Run "zaman"
End Sub
'----------------------------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Save
End Sub
'----------------------------

In cells in range D2:G5 I have expressions like this:


=IF(AND(A1=14;B10;B1<40);"8.ders";IF(AND(A1=14;B1 40);"9.ders";IF(AND(A1=15
;B1<20);"9.ders";IF(AND(A1=15;B130);"10.ders";IF( AND(A1=16;B1<10);"10.ders"
;"_")))))

Thank you for your time
Regards
J_J



"Bob Phillips" wrote in message
...
Test for the watched cells

Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
On Error Resume Next
If Not Intersect(Traget,Range("D2:G5")) Is Nothing Then
For Each c In Range("D2:G5")
If Not Application.Intersect(Target, c.Precedents) Is
Nothing
Then
Interaction.Beep
End If
Next c
End If
On Error GoTo 0
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"J_J" wrote in message
...
The below code

'-------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
On Error Resume Next
For Each c In Range("D2:G5")
If Not Application.Intersect(Target, c.Precedents) Is Nothing
Then
Interaction.Beep
End If
Next c
On Error GoTo 0
End Sub
'----------------------


sound on each minute change of my system clock. You see, cells
A1 and B1 displays the system clock hour and minute values. And the
watching
cells (Range D2:G5) look to the values displayed in A1 and
B1. Then the main macro is executed in minute intervals to let A1 and
B1 refresh their displays. Now although no "display" change is valid
in
the
watched cells the sound alarm beeps in minute intervals too. Maybe my
other
suggestion may prevent that. I hope I didn't confuse you...
Hope we can solve this problem.
Regards
J_J