+ Reply to Thread
Results 1 to 7 of 7

Clear cells if adjacent cell contains certain text from a direct link

  1. #1
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Clear cells if adjacent cell contains certain text from a direct link

    Hi everyone,

    I have the following code:

    Please Login or Register  to view this content.
    What I'm trying to do is find any cell in column B range that contains the letters XYZ in it (part of a larger string). If so, it should clear contents in the same row from columns D to Y. Two caveats:

    1. the values in column B are derived from a direct link to another cell
    2. I've tried using only text values and it still doesn't work

    Any ideas?

    Thanks!!

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Clear cells if adjacent cell contains certain text from a direct link

    Edit: Forgot the lookin, very important per your specs

    No need to loop through every cell:

    Please Login or Register  to view this content.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Clear cells if adjacent cell contains certain text from a direct link

    Hi walrus,

    Thanks very much. Your code works great when the look up value is a string typed into the cell, but what if the cell value is derived from a direct link to another sheet?

    Thanks!

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Clear cells if adjacent cell contains certain text from a direct link

    It should work for that, too.

    If not, can you post an example workbook so that I can see exactly how your direct link is working?

  5. #5
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Clear cells if adjacent cell contains certain text from a direct link

    He Walrus,

    The cells in question are direct-linked as such: =Summary!$B$5. All links are absolutely values, but I've tried relative and that still didn't work. All cells are directly linked in that manner though.

  6. #6
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Clear cells if adjacent cell contains certain text from a direct link

    That code should work just fine assuming you're using the code after i edited in the lookin:=xlValues.

    Again, if it is not, please post an example workbook demonstrating it not working, because the situation you describe is exatly what lookin:=xlValues is meant to address.

  7. #7
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Clear cells if adjacent cell contains certain text from a direct link

    Ah, I didn't see the edit! Works perfect. Thx!

+ 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: 11
    Last Post: 04-30-2015, 05:35 PM
  2. Clear multiple adjacent cells with Offset
    By sadyr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2014, 10:23 PM
  3. Formula to identify part of a text in cell from range of cells & insert adjacent cell text
    By Novicebutnotforlong in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 11-19-2013, 02:11 AM
  4. Clear cells upon adjacent cell change
    By jwstimac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-12-2013, 01:02 PM
  5. [SOLVED] Splitting text from one cell into separate text fragments, Located in adjacent cells
    By onsid in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2013, 08:32 PM
  6. Macro that will clear contents of cell based on format of text in adjacent cell
    By judasdac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-12-2012, 01:56 AM
  7. Macro to find bold cells then clear adjacent cell
    By painterartist in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-26-2011, 04:47 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