+ Reply to Thread
Results 1 to 4 of 4

Clear cells that do not contain specific text which may be at the beginning or end of cell

  1. #1
    Registered User
    Join Date
    12-13-2013
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    10

    Clear cells that do not contain specific text which may be at the beginning or end of cell

    Hello, I am a VBA novice and have the following problem:

    I have a range of cells, each cell containing two sets of staff initials, for eg, JL SW or BN JL

    I want to clear the cells that do not contain one of the sets of initials. I have the following code that works fine if there is just JL in the cell so can anyone help amend it to do the same thing but if JL is part of the cell content? Like a wild card? Many thanks.

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    12-13-2013
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Clear cells that do not contain specific text which may be at the beginning or end of

    I have just found answer as below so thank you and any criticism of my coding would be welcomed.
    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Clear cells that do not contain specific text which may be at the beginning or end of

    Just my 2 cents worth.
    You can change this
    Please Login or Register  to view this content.
    to this
    Please Login or Register  to view this content.
    It is a relatively small range so the looping does not affect the speed all that much.
    Both looping and selecting are to be avoided as much as possible.

  4. #4
    Registered User
    Join Date
    12-13-2013
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Clear cells that do not contain specific text which may be at the beginning or end of

    Thank you very much - I really appreciate your feedback and will take you comments on board. Best wishes Siân

+ 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] Clear cells with specific text in them
    By nicki_rae22 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-26-2015, 01:36 PM
  2. [SOLVED] Clear contents of specific cells on the same row if a specific cell on that row is empty
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2014, 01:48 PM
  3. [SOLVED] VBA Macro To Clear Cell When Specific Text Is Entered
    By paulm99 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-14-2014, 06:52 PM
  4. [SOLVED] Adding Text to Beginning of the Cell if not Blank - Then Combining Cells
    By maemaemae in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-16-2013, 03:32 PM
  5. Clear contents of cells that do not contain specific text, sort cells that do
    By feckless.lout in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2010, 01:41 AM

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