Skip to content

Instantly share code, notes, and snippets.

@ateneva
Last active April 15, 2018 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ateneva/54af2c739846dcf258f54d492211ece1 to your computer and use it in GitHub Desktop.
Save ateneva/54af2c739846dcf258f54d492211ece1 to your computer and use it in GitHub Desktop.
Colour cells that have absolute value greater than 1.96
Sub ColourCellsonAbsoluteValues()
Dim Cell As Range
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'written by Angelina Teneva, September 2016
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For Each Cell In Selection
Cell.Activate
If Cell.Value < 0 Then
Cell.Font.Color = RGB(255, 0, 0) 'Makes negative cells red
Else
Cell.Font.Color = xlNone
End If
If Abs(Cell.Value) > 1.96 Then Cell.Interior.Color = RGB(0, 255, 204)
Next Cell
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment