Highlighting Rows from Unique Value Conditional Format

JamesVan

New Member
Joined
Oct 25, 2014
Messages
3
I need help finding a way to highlight rows while doing a conditional format for the unique values of a column. For example if column had the values

1
1
2
3
3

I would want the entire row 3 highlighted. Also if anyone knows a way to write a macro do the conditional format across workbooks that would be of great help so I don't have to paste over the values that I am comparing.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi,

It sounds as if you need to use COUNTIF to count the number of times a given number occurs in a column.

I have assumed the keys are in column A and the range required is A2:N7. Obviously you could change that.
Below is a macro recording of those settings with unique rows highlighted in blue, or 15773696 as we programmers say :)

Code:
Sub ConditionalFormat()
    Cells.FormatConditions.Delete
    Range("A2:N7").Select
    Range("A2").Activate
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=COUNTIF($A:$A,$A2)=1"
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 15773696
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).StopIfTrue = False
End Sub
 
Upvote 0
This works great for what you wrote it to do however how can I make it Highlight the rows in which it finds the unique values?
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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