getting columns to play sound when data is entered

skidda420

New Member
Joined
Jun 7, 2018
Messages
26
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello, I am trying to get excel to play a sound when data is entered, we scan into a database and sometimes the data does not go through correctly and need some way to notify the user that the data has been entered into the cell so that they may continue scanning. However I am running into an issue where the formula will work in one cell but will not continue into the rest. I am trying to get cells A2 through A160 to play this sound but only A2 is working. The VBA I am using is :
#If Win64 Then
Private Declare PtrSafe Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As LongPtr, ByVal dwFlags As Long) As Boolean
#Else
Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Boolean
#End If
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Function SoundMe() As String
'Updateby Extendoffice 20161223
Call PlaySound("c:\windows\media\cash_register.wav", _
0, SND_ASYNC Or SND_FILENAME)
SoundMe = ""
End Function

which pulls the cash register wav file correctly and plays it when the formula in a162 is set to =IF(A2>0,SoundMe(),"") , however as soon as i set the formula to read =IF(A2:A160>0,SoundMe(),"") I'm greeted with a "#VALUE! error and then none of the cells are recognized to play the sound. I'm pretty sure my formula is not in the correct format to read cells a2 through a160 and was hoping that someone may have some insight on how i can get this to work. Any help is much appreciated!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Enter the formula as an array formula with SHIFT+CTRL+ENTER
{=IF(A2>0,SoundMe(),"")}
 
Upvote 0
Solution

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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