Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default [VBA Excel 2003] How to do it in VBA?

I need to verify in a column which cells are duplicated.
I don´t know how to do it in VBA, or the correct Excel´s function.
Example:

Column X

9675
9868
9868
9619
9868
9619
9619
9619
9619
9619

I want to identify the cells with same contents and mark them, with a
conditional format.

Anybody can help me?

Please!

--
Anitacr
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default [VBA Excel 2003] How to do it in VBA?

I think I'd do it something like this (completely untested)

Dim myRange as Range
Dim r as range
Dim lRow as long

Dim aWS as worksheet
Set aWS = activesheet

set myRange = aws.cells(1,1) 'Change to first cell in range to test
lRow = aws.cells(aws.rows.count,myrange.column).end(xlup) .row

Set myRange = myrange.resize(lrow-myrange.row + 1,1)

for each r in myrange
if not isempty(r) then
if application.worksheetfunction.countif(myrange,r.va lue) 1 then
'Apply conditional format
end if
end if
next r
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Anitacr" wrote:

I need to verify in a column which cells are duplicated.
I don´t know how to do it in VBA, or the correct Excel´s function.
Example:

Column X

9675
9868
9868
9619
9868
9619
9619
9619
9619
9619

I want to identify the cells with same contents and mark them, with a
conditional format.

Anybody can help me?

Please!

--
Anitacr

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default [VBA Excel 2003] How to do it in VBA?

On Thu, 9 Oct 2008 10:37:01 -0700, Anitacr
wrote:

I need to verify in a column which cells are duplicated.
I don´t know how to do it in VBA, or the correct Excel´s function.
Example:

Column X

9675
9868
9868
9619
9868
9619
9619
9619
9619
9619

I want to identify the cells with same contents and mark them, with a
conditional format.

Anybody can help me?

Please!


Just use application.worksheetfunction.countif(range,cell) 1 to determine if
the cells are duplicated.
--ron
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default [VBA Excel 2003] How to do it in VBA?

Don't use a macro its overkill for something simple, you can use conditional
formatting you can select the whole area to give it a name like range1 select
conditional formattingformula is, paste this in =COUNTIF(range1,A1)1 and
select your colour, now all duplicates will e highlighted!

Regards,
The Code Cage Team
www.thecodecage.com/forumz

"Anitacr" wrote:

I need to verify in a column which cells are duplicated.
I don´t know how to do it in VBA, or the correct Excel´s function.
Example:

Column X

9675
9868
9868
9619
9868
9619
9619
9619
9619
9619

I want to identify the cells with same contents and mark them, with a
conditional format.

Anybody can help me?

Please!

--
Anitacr

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 versus Excel 2003 & Excel 97-2003 fully compatible Bumpersnesty Excel Worksheet Functions 0 April 26th 10 09:44 PM
import Excel 2003 file into Outlook 2003 - NO NAMED RANGES?? lewisma9 Excel Discussion (Misc queries) 0 February 27th 07 12:23 AM
Transferring Large Amount of Data from Excel 2003 to Access 2003 [email protected] Excel Programming 3 January 12th 07 05:48 PM
Copying Excel 2003 Selection into Outlook 2003 HTML E-Mail Message [email protected] Excel Discussion (Misc queries) 0 July 10th 06 03:07 PM
Word 2003 Find/Change Automation from Excel 2003 crashes Excel 200 Joel Berry Excel Programming 9 March 6th 06 10:20 PM


All times are GMT +1. The time now is 06:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"