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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
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,223,060
Messages
6,169,861
Members
452,286
Latest member
noclue2000

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