white_flag
Active Member
- Joined
- Mar 17, 2010
- Messages
- 331
Hello:
I have an range that will return zero values but like this =B26*G45 not luike an value (zero) the calculation will be zero. Can some one give mean code that if the result of the cell is zero then the cell to become in an different color.
I found this code on this site:
I have an range that will return zero values but like this =B26*G45 not luike an value (zero) the calculation will be zero. Can some one give mean code that if the result of the cell is zero then the cell to become in an different color.
I found this code on this site:
Code:
Function HasZerosOnly(ByVal Target As Range) As Boolean
Dim c As Range
For Each c In Target
If Not c.Value = 0 Then Exit Function
Next
HasZerosOnly = True
End Function
Code:
'this is inside of the sub
If HasZerosOnly(my_range) Then my_range.Cells.Interior.Color = 36