+ Reply to Thread
Results 1 to 3 of 3

Excel VBA Hide Duplicate Cell Contents If Two Columns Match Criteria

  1. #1
    Registered User
    Join Date
    03-27-2013
    Location
    Vernon Hills, IL
    MS-Off Ver
    Excel 2011
    Posts
    2

    Excel VBA Hide Duplicate Cell Contents If Two Columns Match Criteria

    Hello,

    First post here on this site. If I have made any etiquette mistakes, please let me know.

    I have a workbook with two sheets.

    Sheet 1 has data entries in order of their entry.
    Sheet 2 is a Table of the same data entries sorted by Author Last Name, Author First Name, Publication Year, Publication Month, Publication Day and Book Type.

    The goal is to HIDE duplicate entries of Author Last Name and Author First Name in the Table on Sheet 2.

    The following code works until it encounters an author with the same last name, but a different first name from another author. It hides the Author’s Last Name even when the Author First Name is different.

    I would like to use VBA to perform this procedure. Also first time writing code, so suggestions on how to amend this code as opposed to another method would be appreciated.

    Here is a condensed version of what I am trying to accomplish.


    Col A Col B Col C Col D
    1 ID AUTHOR AUTHOR TITLE
    LAST NAME FIRST NAME

    2 953 Albom Mitch One More Day
    3 653 Five People You Meet In Heaven, The
    4 17 Right
    5 1200 Alexander Victoria What Happens At Christmas
    6 15 Baldacci Anne All Dogs
    7 16 Good Dogs
    8 1196 Baldacci David Forgotten, The
    9 1154 Innocent, The

    My Workbook is attached.

    SampleWorkbook.xlsm

    Here is the code I would like to amend. It is located in Module 2 for testing purposes. When it is correct, it will be added to the Forms: frmTest code.


    Please Login or Register  to view this content.
    As I said, I am a novice at writing code and would appreciate any suggestions being explained. Thank you in advance for your help.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Excel VBA Hide Duplicate Cell Contents If Two Columns Match Criteria

    You can use Pivot Table instead of using VBA code

    Refer the attached file for details.
    Attached Files Attached Files


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    03-27-2013
    Location
    Vernon Hills, IL
    MS-Off Ver
    Excel 2011
    Posts
    2

    Re: Excel VBA Hide Duplicate Cell Contents If Two Columns Match Criteria

    Thank you, SixthSense for taking the time and trouble to build the pivot table. However, it is not sorting the order of last names properly.

    That said, I already have everything set up in my workbook and would prefer to amend the code I posted above to resolve the issue.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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