+ Reply to Thread
Results 1 to 9 of 9

VBA clear cell in table if not in list

  1. #1
    Registered User
    Join Date
    07-20-2015
    Location
    New York, US
    MS-Off Ver
    2013
    Posts
    43

    VBA clear cell in table if not in list

    Hi gurus,

    Firstly thank you to anyone who responds, it's always appreciated.

    I have a list of businesses in column A of Sheet2 and a table of records in columns C:Z in Sheet1.

    Businesses listed in column A of Sheet2 can appear anywhere in the table in Sheet1, but a corresponding percentage is always in the cell directly to the right of the cell with their business name.

    Is there VBA code that could clear the businesses names and the corresponding percentages (cells to the right) from the table in Sheet1 if the business does not appear in the list in Column A of Sheet2? Note: I want to clear the cells not delete them.

    An example workbook is attached. Please let me know if I need to clarify anything!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA clear cell in table if not in list

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: VBA clear cell in table if not in list

    See next code
    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

  4. #4
    Registered User
    Join Date
    07-20-2015
    Location
    New York, US
    MS-Off Ver
    2013
    Posts
    43

    Re: VBA clear cell in table if not in list

    Amazing, works perfectly with a copy paste. Wish I had your skills. Thanks!!

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA clear cell in table if not in list

    You're welcome. Glad to help out and thanks for the feedback and the rep.

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: VBA clear cell in table if not in list

    "Amazing, works perfectly with a copy paste"
    You did what must be done to succeed quickly: you attached an example.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: VBA clear cell in table if not in list

    Late entry but, as I've done it, you might as well have it and test it.

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  8. #8
    Registered User
    Join Date
    07-20-2015
    Location
    New York, US
    MS-Off Ver
    2013
    Posts
    43

    Re: VBA clear cell in table if not in list

    Also works perfectly TMS! I really struck it lucky on this post with you three.

    I have actually moved on to my next problem if you guys have the time/inclination to look at it, link below. Sorry if this is against forum rules?

    http://www.excelforum.com/excel-prog...ml#post4137246

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: VBA clear cell in table if not in list

    You're welcome. Thanks for the rep.

    No, not against the rules. In fact, new question, new thread, exactly what we would hope for.

    Regards, TMS

+ 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. Clear dependent list based on a cell value!
    By veray in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-01-2015, 06:54 AM
  2. Replies: 3
    Last Post: 08-16-2014, 09:55 AM
  3. Clear List Macro for Data Validation, Multiple Lines in table
    By gedwards913 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2014, 04:42 PM
  4. [SOLVED] Clear named table data except formula in cell 2A
    By wellsw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2013, 02:09 PM
  5. Change cell from dropdown list and clear other cells in row
    By Dale Schultz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2012, 09:30 AM
  6. Automatically Clear Cell in Drop Down List
    By kingdt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-20-2007, 11:25 AM
  7. [SOLVED] List box VBA script to clear cell in other sheet.
    By Calle in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-03-2006, 03:00 PM

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