+ Reply to Thread
Results 1 to 7 of 7

How to color duplicate cells in VBA

  1. #1
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Albania
    MS-Off Ver
    2013
    Posts
    215

    How to color duplicate cells in VBA

    Hello VBA's friends, I'll put here a code that does its job well, in fact it highlights duplicates, however this code only works on one vertical range (1 column) but I would like to highlight all duplicates on all ranges (column A and B)
    Thank you
    Please Login or Register  to view this content.
    EDIT i would like to keep this For Each loop that I'm more familiar
    Attached Files Attached Files
    Last edited by XLalbania; 05-30-2021 at 08:37 AM.

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: How to color duplicate cells in VBA

    I see this in your code
    Please Login or Register  to view this content.
    this never see to column B

    cheers
    Leo

  3. #3
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Albania
    MS-Off Ver
    2013
    Posts
    215

    Re: How to color duplicate cells in VBA

    Hi Leo,
    Thanks for the answer i tried with Range("A1:B8") but does not work, there is an error run time 1004 on this line of code
    Please Login or Register  to view this content.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: How to color duplicate cells in VBA

    You can't match that way.
    Dictionary instead.
    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: How to color duplicate cells in VBA

    How about
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Albania
    MS-Off Ver
    2013
    Posts
    215

    Re: How to color duplicate cells in VBA

    Hello friends
    Thank so much @Fluff213 and @Jindon both codes work fine
    But since I'm learning VBA, what is
    Please Login or Register  to view this content.
    ? this is new for me.... VBA never End
    I add reputation to @jindon only because as been faster
    Thank you so much

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: How to color duplicate cells in VBA

    That the part is setting the reference to Dictionary object.

    https://docs.microsoft.com/en-us/off...tionary-object

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 10-12-2018, 12:19 PM
  2. Replies: 2
    Last Post: 02-06-2015, 09:15 PM
  3. Replies: 3
    Last Post: 02-06-2015, 09:10 PM
  4. Find duplicate text in cells in column, then give names of cells containing duplicate text
    By spelunkerforlife in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-19-2013, 10:13 AM
  5. Find a duplicate and then use the duplicates interior.color to change cell color.
    By bopsgtir in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-01-2012, 03:54 PM
  6. mark duplicate cells with different color
    By seesun in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2011, 11:28 AM
  7. Replies: 2
    Last Post: 06-10-2011, 10:26 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1