+ Reply to Thread
Results 1 to 5 of 5

Deleting Columns based on Cell Values VBA

  1. #1
    Registered User
    Join Date
    06-23-2014
    Location
    england
    MS-Off Ver
    2013
    Posts
    78

    Deleting Columns based on Cell Values VBA

    Hi all

    Hoping someone can help me with the below code

    Please Login or Register  to view this content.
    I've found the code above online, changing it slightly to cover multiple cell values etc and it works exactly as required.

    However,

    Whilst three of the four cell values need to be an exact match and if found delete the column.

    I need the fourth phrase "THIS IS THE PROBLEM AREA" to delete on a partial match.

    The phrase would be "Explain why some elements..", with the ... being a variety of things.

    Is this possible at all and if so can someone help me please

    Cheers

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Deleting Columns based on Cell Values VBA

    Hi,
    Try this:
    Please Login or Register  to view this content.
    Last edited by MarvinP; 08-20-2014 at 08:02 AM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    06-23-2014
    Location
    england
    MS-Off Ver
    2013
    Posts
    78

    Re: Deleting Columns based on Cell Values VBA

    Hi Marvin,

    Cheers for the help, the above suggested code is much smoother than mine.

    The first three work like a charm these are always exact matches!!!

    however in the fourth example - Cells(1, iCntr) = "THIS IS THE PROBLEM AREA"

    I'm replacing this with Cells(1, iCntr) = "Explain why some elements remain"

    However it wont find the examples below.

    Explain why some elements remain for A
    Explain why some elements remain for B
    Explain why some elements remain for C

    Is there a way to find a partionl match on "Explain why some elements remain" as this is always the same, ignoring the variable A, B & C

    Cheers again!!!

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Deleting Columns based on Cell Values VBA

    Try this for a partial match.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  5. #5
    Registered User
    Join Date
    06-23-2014
    Location
    england
    MS-Off Ver
    2013
    Posts
    78

    Re: Deleting Columns based on Cell Values VBA

    Thanks Both Works Like A CHARM!!!!!!!!

    Need to remember the Like and wildcard

+ 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] Deleting multiple columns based on columns' first row value
    By {=OR(value=array)} in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2014, 04:00 PM
  2. Locking columns based on calculated cell values in columns across a sheet.
    By andyr826208 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-04-2012, 05:17 AM
  3. Replies: 4
    Last Post: 06-28-2012, 07:08 AM
  4. deleting rows using vba, based on values in a cell
    By kckar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2007, 01:54 AM
  5. Deleting row unless certain values in certain columns
    By Kris in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-29-2006, 12:55 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