Last active
April 18, 2018 08:38
-
-
Save ateneva/2c5b979c0bedb3d38258ebe76d1a0af9 to your computer and use it in GitHub Desktop.
Colour a range of cells if they meet a certain condition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub ColourCellsin_DifferentColumn() | |
Dim Cell As Range | |
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
'written by Angelina Teneva, September 2016 | |
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
For Each Cell In Range("F5:F" & ActiveSheet.UsedRange.Rows.Count) | |
Cell.Activate | |
Range(ActiveCell.Offset(0, -5), ActiveCell.Offset(0, 4)).Font.Color = RGB(0, 0, 0) 'black (reset any previous formatting) | |
If ActiveCell.Value > 10 Then Range(ActiveCell.Offset(0, -5), ActiveCell.Offset(0, 4)).Font.Color = RGB(255, 0, 0) 'red | |
Next Cell | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment