Hello!
I am somewhat new to the world of VBA/Macros and have mainly stumbled through using them by way of copying and pasting what I find online.
I am trying to make it so that when I have values in every cell of a column of tasks I have for myself (F5:F23), a sound effect goes off and a message box pops up saying I've completed them all. Trouble is, if I update any value in F5:F23 a SECOND time, the sound effect goes off again which I don't want it to do. I only want the sound effect/message to go off the FIRST time I complete all tasks (ie. sometimes I complete a task twice and update that particular column twice with a new value).
I have programmed sound effects and gotten them to work, such as this one:
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 StarWars()
Call PlaySound("C:\Windows\Media\tada.wav", _
0, SND_ASYNC Or SND_FILENAME)
StarWars = ""
MsgBox "Well done. You have obtained Queen status."
End Function
Display More
How can I make it so that a sound effect and message box goes off only the FIRST time I get all my tasks in F5:F23 completed? This is as close as I've gotten, from copying from this thread: http://www.ozgrid.com/forum/showthread.php?t=182386
Function TaskListCompleted()
If Range("AM23") = "" Then
Call PlaySound("C:\Windows\Media\tada.wav", _
0, SND_ASYNC Or SND_FILENAME)
TaskListCompleted = ""
MsgBox "You completed Combo #1!"
End If
Range("AM23") = "Completed!"
End Function
Display More
When I try the code above, it says "Compile Error: Sub or Function not defined." I don't use Subs because I don't want to have to click a button, I just want it to happen naturally as part of a Formula.
Thank you in advance! I have searched ALL over for something similar.
Jake