if column value 0 highlight the value.

dilipgr

New Member
Joined
Jan 30, 2015
Messages
43
hi friends

if the value of column C value = 0 then highlight the cell value. I'm using the below code but unable to get the correct value.

Range("c3:c95").Select
If Range("c3:c95").Value = "0" Then
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0

End With
End If

my spreedsheet:-

SL NOStnCodeINBOUND
1AKM458
2APK2043
3ARR0
4ART19420
5ASD733
6ATR0
7BTU733
8CDM0
9CGL627
10CJB1817

<tbody>
</tbody>


regards.

Dilipkumar.V
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
try
Code:
Sub MM1()
For Each c In Range("c3:c95")
If c.Value = "0" Then
With c.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
End With
End If
Next c
End Sub
 
Upvote 0
Alternatively, try:
Code:
Sub Highlight_0()

Dim rng As Range

Application.ScreenUpdating = False

With activeworksheet

    If .AutoFilterMode Then .AutoFilterMode = False
    Set rng = .Range("C3:C95")
    With rng
        .Interior.Color = xlNone
        .AutoFilter
        .AutoFilter field:=1, Criteria1:=0
        .SpecialCells(xlCellTypeVisible).Interior.Color = RGB(255, 0, 0)
    End With
    .AutoFilterMode = False
    Set rng = Nothing
    
End With

Application.ScreenUpdating = True

End Sub
 
Upvote 0

Forum statistics

Threads
1,217,365
Messages
6,136,124
Members
449,993
Latest member
Sphere2215

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top