Apply Macro To Other Ranges
Hi Gerard,
"Ambiguous Name Detected" is having more than one sub with the same sub name
and since events must have specific sub names then you can only have one
anyway.
What conditions decide which range is to be processed? Is it the actual
range being changed to cause calculation to run?
I am wondering if the calculate event is the best option to trigger your
code so can you give us a little more information on what occurs leading up
to triggering the event. I am assuming that you are after an audible signal
when certain conditions occur.
--
Regards,
OssieMac
"Gerard Sanchez" wrote:
'Hi,
'I was wondering how to apply this code to also apply to ranges:
'H102 & H103 . . .H154 & H155 . . .H206 & H207 . . . and so on . . .
'tried to cut and paste the code from Private Sub to End Sub changing only
the Ranges (i.e. above)
'but got an error message "Ambiguous Name Detected:
Workbook_SheetCalculate"
Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
Static OnlyOnce As Boolean
If OnlyOnce Then Exit Sub
If Range("H51").Value = "" Or Range("H51").Value = 0 Then Exit Sub
If Range("H50").Value = Range("H51") Then
sndPlaySound32 "ding", 1&
OnlyOnce = True
End If
End Sub
|