Hello,
I'm having trouble making a modification to my existing working code. I've tried multiple combinations but can't seem to get it to work.
I would like to add the condition that if Worksheets("Index").Range("C28").Text = "1" Then this function will only evaluate Worksheets("Underlying Assets, Settings")
i.e. the function is not active on any other worksheet at that time.
Any help would be appreciated, thanks.
I'm having trouble making a modification to my existing working code. I've tried multiple combinations but can't seem to get it to work.
I would like to add the condition that if Worksheets("Index").Range("C28").Text = "1" Then this function will only evaluate Worksheets("Underlying Assets, Settings")
i.e. the function is not active on any other worksheet at that time.
Any help would be appreciated, thanks.
Code:
Public Function Alarm(cell, Condition) As Boolean
Dim strAlarmHTKpath As String, varProc As Variant
Debug.Print "Alarm: " & cell.Address
On Error GoTo ErrHandler
If Evaluate(cell.Value & Condition) Then
If Worksheets("Index").Range("C28").Text <> "" Then 'Alarm is disabled
'strAlarmHTKpath = "C:\users\dropbox\alarm.exe" 'Alarm will not sound
Else
strAlarmHTKpath = "C:\users\dropbox\alarm.exe" 'Must be an exe file, .ahk won't work; Alarm will sound
varProc = Shell(strAlarmHTKpath, 1)
End If
Alarm = True
Exit Function
End If
ErrHandler:
Alarm = False
End Function