Macro - highlight rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everybody,

I have a chunk of records stored in excel and are tracked by account number.
Some of the account numbers are duplicated and I wish to run a macro which
can loop through the records and highlight the row s which have duplicated
account numbers. How do i do it? Thanks in advance
 
You don't need a macro, conditional formatting will do it.

Select all the rows.
Menu Format>Conditional Formatting
Change Condition 1 to Formula Is
Add a formula of =COUNTIF($A:$A,A1)>1
Click Format, select the Pattern tab, and choose a colour
OK out

This assumes the account is in column A, and you start at row 1.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
It does not work. It highlighted wrong records which are not duplicated
 
Works for me, although it is better if the formula is

=COUNTIF($A:$A,$A1)>1


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top