Q: Using CheckBox in Cell to Mute Beep Sound upon Value > 999 I have a function to make a beep sound whenever cell value crosses above 1999, also have a "Counter" cell to count the number of times values have been > than 1999. Function is working as expected, however now I need to embed a CheckBox, if checkBox is selected, the sound should be muted but the Counter should continue counting and when CheckBox is not checked it should continue to make Beep Sound. Here is my code. I m calling this function from the cell.
Function TargetCounter2KAC(RngMeasure As Range)        
    If RngMeasure.Value > 1999 Then
        If BlnAboveHundred2K = False Then
            IntCounter2K = IntCounter2K + 1
            Call PlaySound("c:\windows\media\Alert4Target2Filled.wav", _
              0, SND_ASYNC Or SND_FILENAME)
            
            BlnAboveHundred2K = True
        Else
            BlnAboveHundred2K = True            
        End If
    Else
        BlnAboveHundred2K = False
    End If

    TargetCounter2KAC = IntCounter2K
End Function


A: Add an Active-X checkbox on your sheet:

You can use the properties to change the name if you want.
In your code change it to:
Function TargetCounter2KAC(RngMeasure As Range)
    
    If RngMeasure.Value > 1999 Then
        If BlnAboveHundred2K = False Then
            IntCounter2K = IntCounter2K + 1

            ' here is the change:
            if Sheets("Sheet1").checkbox1.Value = false then Call PlaySound("c:\windows\media\Alert4Target2Filled.wav", 0, SND_ASYNC Or SND_FILENAME)

            ' or if you want a X in an empty cell method:
            'if Sheets("Sheet1").Range("A1").Value = "" then Call PlaySound("c:\windows\media\Alert4Target2Filled.wav", 0, SND_ASYNC Or SND_FILENAME)
            ' if A1 is the cell to toggle on/off


            BlnAboveHundred2K = True
            
            Else
            
            BlnAboveHundred2K = True
                        
        End If
        
    Else
    
        BlnAboveHundred2K = False
        
    End If

    TargetCounter2KAC = IntCounter2K
    
End Function

