ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro - highlight rows (https://www.excelbanter.com/excel-programming/392560-macro-highlight-rows.html)

Zen

Macro - highlight rows
 
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

Bob Phillips

Macro - highlight rows
 
You don't need a macro, conditional formatting will do it.

Select all the rows.
Menu FormatConditional 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)

"Zen" wrote in message
...
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




Zen

Macro - highlight rows
 
It does not work. It highlighted wrong records which are not duplicated

"Bob Phillips" wrote:

You don't need a macro, conditional formatting will do it.

Select all the rows.
Menu FormatConditional 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)

"Zen" wrote in message
...
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





Bob Phillips

Macro - highlight rows
 
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)

"Zen" wrote in message
...
It does not work. It highlighted wrong records which are not duplicated

"Bob Phillips" wrote:

You don't need a macro, conditional formatting will do it.

Select all the rows.
Menu FormatConditional 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)

"Zen" wrote in message
...
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







Zen

Macro - highlight rows
 
Hi Bob, it works! It works!. Thanks for the assistance. :)

"Bob Phillips" wrote:

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)

"Zen" wrote in message
...
It does not work. It highlighted wrong records which are not duplicated

"Bob Phillips" wrote:

You don't need a macro, conditional formatting will do it.

Select all the rows.
Menu FormatConditional 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)

"Zen" wrote in message
...
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








All times are GMT +1. The time now is 10:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com