+ Reply to Thread
Results 1 to 14 of 14

Find & highlight rows using VBA

  1. #1
    Registered User
    Join Date
    01-30-2013
    Location
    India
    MS-Off Ver
    2013
    Posts
    56

    Find & highlight rows using VBA

    Hi Experts,

    I need to highlight duplicate rows based on 3 columns using VBA.

    This is what I am looking for.

    Compare the values in column B, F & H.
    Highlight the duplicate values in column F & H. Also highlight the newest value in "Green" in column L & M based on the date in column B. I've attached a sample spreadsheet.

    I tried using the conditional formatting with formula but my spreadsheet is freezing and lands in to recovery mode. The file has more than 10000 rows.
    Attached Files Attached Files

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Find & highlight rows using VBA

    Hi Max_excel,

    Try below code based on your sample file ...

    Please Login or Register  to view this content.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  3. #3
    Registered User
    Join Date
    01-30-2013
    Location
    India
    MS-Off Ver
    2013
    Posts
    56

    Re: Find & highlight rows using VBA

    Hi nankw8,

    Thanks for the code it works like charm.

    However, I missed to inform that Rows 1 & 2 are merged as these are the headers, these rows doesn't require to highlight duplicates. Also, column O has formula and is being removed when I run this code.

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Find & highlight rows using VBA

    Can you post a sample file that mimics your original file along with the merge cells so I can adjust the code accordingly

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Find & highlight rows using VBA

    Another Option...
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  6. #6
    Registered User
    Join Date
    01-30-2013
    Location
    India
    MS-Off Ver
    2013
    Posts
    56

    Re: Find & highlight rows using VBA

    Sure, I've attached the sample file "Sample_Find Duplicate"
    Attached Files Attached Files

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Find & highlight rows using VBA

    For my code just change 2 to 3

    Please Login or Register  to view this content.

    PS...Are you guys also experiencing issues with the Forums Layout & View....
    Untitled.png
    Last edited by sintek; 08-26-2020 at 06:26 AM.

  8. #8
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Find & highlight rows using VBA

    Code revised ...

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    01-30-2013
    Location
    India
    MS-Off Ver
    2013
    Posts
    56

    Re: Find & highlight rows using VBA

    I tried your option 2 and it worked on my sample sheet. However, I get Run Time error - 1004 Application-defined or object-defined error when pasted this code on my master report. I've attached the screenshot.

    Forum page is loading perfectly for me
    Attached Images Attached Images

  10. #10
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Find & highlight rows using VBA

    Quote Originally Posted by sintek View Post
    PS...Are you guys also experiencing issues with the Forums Layout & View....
    Yes, I am having the same issue

  11. #11
    Registered User
    Join Date
    01-30-2013
    Location
    India
    MS-Off Ver
    2013
    Posts
    56

    Re: Find & highlight rows using VBA

    Thanks so much! The last version of code does the job.

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Find & highlight rows using VBA

    My bad...missing a Point see red dot

    Please Login or Register  to view this content.
    Last edited by sintek; 08-26-2020 at 08:30 AM.

  13. #13
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Find & highlight rows using VBA

    Glad to help & thanks Max_excel for the reps

  14. #14
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Find & highlight rows using VBA

    Glad you got it sorted...tx for rep +

+ 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. Find All and highlight selected rows
    By amberle in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-06-2020, 08:45 AM
  2. Problem with macro that needs to find and highlight rows based on searching cells
    By mnk181 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2014, 12:24 PM
  3. Replies: 1
    Last Post: 02-17-2014, 03:17 PM
  4. Quick way to find and highlight multiple rows?
    By tnovak in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 02-14-2014, 01:09 PM
  5. Replies: 0
    Last Post: 11-12-2013, 04:56 PM
  6. Replies: 2
    Last Post: 06-27-2012, 12:27 PM
  7. [SOLVED] highlight/remove highlight of rows conditional on cellvalue
    By timtim89 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2012, 07:14 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