Macro Running on each refresh

PhillB

New Member
Joined
Sep 15, 2008
Messages
6
HI. I have created a tracking sheet which takes data from another excel sheet by refreshing links every 30 seconds (would use share workbook but function not enabled by my work). I have created a macro to play every time a cell in a range is changed to a value above 0 but it reads every refresh as a change and plays every 30 seconds. Is there any way to prevent this?
Thanks
 
Last edited:

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Well create is an overstatement, copied is more accurate.
Code:
Private Declare Function PlaySound Lib "winmm.dll" _
  Alias "PlaySoundA" (ByVal lpszName As String, _
  ByVal hModule As Long, ByVal dwFlags As Long) As Long
    Const SND_SYNC = &H0
    Const SND_ASYNC = &H1
    Const SND_FILENAME = &H20000
    Function SoundMe() As String
    Call PlaySound("c:\windows\media\swtheme", _
      0, SND_ASYNC Or SND_FILENAME)
    SoundMe = ""
End Function

With a trigger in each cell of a column going down the table
Code:
=IF(K3>0,SoundMe(),"")
 
Upvote 0
The way that is set up then its going to play the sound each time the cell calculates should the IF be true. There is no way to prevent that unless calculation is off.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,251
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top