+ Reply to Thread
Results 1 to 2 of 2

VBA Code to highlight duplicate

  1. #1
    Registered User
    Join Date
    03-05-2021
    Location
    Sydney, Australia
    MS-Off Ver
    2016
    Posts
    1

    VBA Code to highlight duplicate

    Hi Team,
    I have a data in column B that is sorted in order e.g. Apple, Apple, Apple, Orange, Orange, Orange, Mango, Mango Mango...
    I need a VBA code where the [B]last[B] duplicate is highlighted.

    I was trying to find a simple formula to for example put a '1' in column A next to the last duplicate in column B but i couldn't find a formula, so I resulted in trying to do a VBA code instead..

  2. #2
    Banned User!
    Join Date
    01-17-2021
    Location
    Omaha, NE
    MS-Off Ver
    office 2016
    Posts
    211

    Re: VBA Code to highlight duplicate

    you can do with functions yes but you will want *findnext* and *find*. then you go through range from top to bottom and get the value of each cell when you are checking it. the way you highlight last cell is put value in for *cell.interior* if *findnext* returns nothing. nothing means that you are at last cell with that value, and it was not found again all the way down the column.

+ 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. [SOLVED] How to highlight duplicate Code and different Name?
    By metrostar in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-06-2020, 10:11 AM
  2. Highlight or display duplicate rows not duplicate values
    By olga6542 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-20-2019, 03:24 PM
  3. [SOLVED] VB Code to highlight duplicate entries
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2019, 10:20 AM
  4. Highlight duplicate cell values in a row with different color code
    By picon1983 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-07-2017, 12:05 AM
  5. Need help - Highlight Duplicate value
    By sanju2323 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-10-2016, 10:22 AM
  6. Highlight duplicate value
    By tariqnaz2005 in forum Excel General
    Replies: 3
    Last Post: 11-26-2013, 09:41 AM
  7. Replies: 4
    Last Post: 09-18-2012, 09:06 AM

Tags for this Thread

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