Search code examples
openoffice.orgopenoffice-calc

Open Office Spreadsheet: sound alert when cell is positive


I can colour a cell using conditional formatting. But how can I set a sound alert when a cell has turned positive?

Thank you for your help.


Solution

  • Go to Tools -> Macros -> Organize Macros -> LibreOffice Basic and add the following code:

    Sub ContentChanged (oCellChanged As Object)
        oSheet = ThisComponent.Sheets(0)
        oCell = oSheet.getCellRangeByName("A1")
        If oCell.getValue() > 0 Then
            Beep
        End If
    End Sub
    

    Then go to sheet 1, right click on the tab and select Sheet Events. Set the Content changed event to point to the macro.

    Now it will beep when cell A1 is greater than zero.