highlight rows based on to criteria

praveenkammar

New Member
Joined
Aug 18, 2010
Messages
14
hi all,

I have column A with some amounts with negative and positive values, column B with alphanumeric values, i have the below code which highlights rows if the negative and positive value sums up to 0. but I need a code which highlights rows if column B is duplicate and sum in column A is 0.

A B
10.1 29ab287
12 37gj238
12 487jhj2897
10.1 29ab287
42 46872

Please help!!!!!!!!


HTML:
Sub MG07Jul24()
Dim rng As Range
Dim Dn As Range
Set rng = Range(Range("B1"), Range("B" & Rows.Count).End(xlUp))
    With CreateObject("scripting.dictionary")
        .CompareMode = vbTextCompare
For Each Dn In rng
    If Not .Exists(Abs(Dn.Value)) Then
        .Add Abs(Dn.Value), Dn
    Else
        If .Item(Abs(Dn.Value)).Count = 1 And .Item(Abs(Dn.Value)) + Dn.Value = 0 Then
            Set .Item(Abs(Dn.Value)) = Union(.Item(Abs(Dn.Value)), Dn)
            '.Item(Abs(Dn.Value)).Font.ColorIndex = 3
            .Item(Abs(Dn.Value)).Interior.ColorIndex = 6
         End If
    End If
Next
End With
End Sub
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,223,725
Messages
6,174,134
Members
452,546
Latest member
Rafafa

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