ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Using "IF" statements (https://www.excelbanter.com/excel-worksheet-functions/14304-using-%22if%22-statements.html)

Steven

Using "IF" statements
 
If a returned value=true, how can I change the background color and font?
Can I also add a audio alarm if value=true?

Steve

You could use conditional formatting

Format, Conditional Formatting
Cell value is, equal to, TRUE

Select your Font and Background colour.

There's no provision for sound.

The alternative is VBA code to test a range of cells

Sub HighlightTrue()
Dim C As Range
For Each C In Selection
If C.Value = True Then
C.Interior.ColorIndex = 6
C.Font.ColorIndex = 46
Beep
Else
C.Interior.ColorIndex = 0
C.Font.ColorIndex = 1
End If
Next C
End Sub

HTH
Steve





"Steven" wrote in message
...
If a returned value=true, how can I change the background color and font?
Can I also add a audio alarm if value=true?





All times are GMT +1. The time now is 03:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com