Open Office Spreadsheet: sound alert when cell is positive

时间:2016-04-15 11:12:09

标签: openoffice.org openoffice-calc

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.

1 个答案:

答案 0 :(得分:1)

转到Tools -> Macros -> Organize Macros -> LibreOffice Basic并添加以下代码:

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

然后转到表单1,右键单击选项卡并选择Sheet Events。将Content changed事件设置为指向宏。

现在,当单元格A1大于零时,它会发出蜂鸣声。