LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default why does it sounds every minute?-Help please

Hi Tom,
That did it !
Reading the whole watched range into a variable and then checking for any
change to activate the alarm sound was magnificent.
You are not judt teaching me "how" to code but how to "think for
alternatives" as well. Your Worksheet_Change sub is superb.
Thanks a million...
J_J

"Tom Ogilvy" wrote in message
...
In your general module add the declaration at the top outside any
procedu
'------------------
Public vArr as Variant

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 (alter as shown)

Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range, rng as Range
Dim i as Long, j as Long
Dim bChange as Boolean
On Error Resume Next
if Target.Address = "$C$1" Then
bChange = False
For Each c In Range("D2:G5")
i = c.row - 1
j = c.column - 3
if c.Value < vArr(i,j) then
bChange = True
exit for
end if
Next c
if bChange then
Interaction.Beep
vArr = me.Range("D2:G5").Value
End if
End if
On Error GoTo 0
End Sub

'and in ThisWorkbook code page I have:

'--------------------
Private Sub Workbook_Open()
Application.Run "zaman"
vArr = Sheets("Sheet1").Range("D2:G5"
End Sub
'----------------------------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Save
End Sub
'----------------------------

--
Regards,
Tom Ogilvy


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

Yours and Bernie Deitrick'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


"Tom Ogilvy" wrote in message
...
Maybe:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range, rng as Range
On Error Resume Next
set rng = Range("A1:B1")
' don't trigger on a change to A1 or B1
if not intersect(rng,Target) is nothing then exit sub
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

--
Regards,
Tom Ogilvy

"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










 
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
Sounds paulport Excel Discussion (Misc queries) 2 March 28th 07 01:02 AM
sounds in Excel Green Wizard Excel Discussion (Misc queries) 2 March 9th 06 05:26 PM
Excel Sounds Trojan Excel Discussion (Misc queries) 5 November 20th 05 09:42 AM
convert time from 60 minute hour to 100 minute hour Jboerding Excel Discussion (Misc queries) 2 July 6th 05 11:30 PM
convert 100 minute hour to a 60 minute hour Todd Excel Worksheet Functions 1 November 15th 04 06:14 PM


All times are GMT +1. The time now is 06:50 AM.

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

About Us

"It's about Microsoft Excel"