ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Coloring a range depending on a cell value (https://www.excelbanter.com/excel-programming/341943-re-coloring-range-depending-cell-value.html)

Ctech[_13_]

Coloring a range depending on a cell value
 

Mine colors the row of the cell with a value more then 0:

Its not the best as I have used If not ... but it works


Sub ChangeRowColor()
Dim Cell As Range

For Each Cell In Range("Q1:Q20")
If IsEmpty(Cell) Then GoTo EmptyCell

If Not Cell <= 0 Then
Cell.EntireRow.Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End If

Next Cell

EmptyCell:
MsgBox "All Suppliers with a positiv 'Grand Total' is now colored red"
End Su

--
Ctec
-----------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...fo&userid=2774
View this thread: http://www.excelforum.com/showthread.php?threadid=47330



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

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