+ Reply to Thread
Results 1 to 7 of 7

delete whole column if 1:20 contains any one of 5 pieces of text

  1. #1
    Forum Contributor
    Join Date
    07-16-2007
    Posts
    174

    delete whole column if 1:20 contains any one of 5 pieces of text

    hi, i would like to be able to use a macro that will delete all columns in the sheet that do not contain one of 5 pieces of text in cells 1 to 20.

    It is driving me mad, i have managed to find macros that delete empty columns, but they do not remove the columns that do not contain any of the 5 words. often the cells are empty down to row 5, when the data starts

    Any help would be great as it would make life a lot easer for me!

    Regards, Jamie
    Last edited by jamiepullen; 10-04-2008 at 03:59 PM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Clears the columns instead of deleting. Change Text1 etc to your words

    Please Login or Register  to view this content.
    amended... or
    Please Login or Register  to view this content.
    VBA Noob
    Last edited by VBA Noob; 09-28-2008 at 05:36 PM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    jamiepullen,

    Please read forum rules below and then add the link to the other forum as Cross Posting Without Links is not permitted

    VBA Noob

  4. #4
    Forum Contributor
    Join Date
    07-16-2007
    Posts
    174
    sorry, did not do on purpose. have re read the rules on cross posting

    i have also posted the query here:

    http://www.mrexcel.com/forum/showthr...67#post1697967

    i will also out of courtesy to the other forum, put a link up there.

  5. #5
    Forum Contributor
    Join Date
    07-16-2007
    Posts
    174
    sorry for the cross post problem. the macro sort of works great, but i was hoping it would delete all columns that did not contain any of the text in the first 20 cells. currently it deletes all that do contain the text.
    is that an easy fix?

    Regards, jamie

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Not what your title says
    delete whole column if 1:20 contains any one of 5 pieces of text
    Try changing to =0.

    VBA Noob

  7. #7
    Forum Contributor
    Join Date
    07-16-2007
    Posts
    174
    think my posting was a disaster this time! Thanks for the code, it works fine now. i will try and think before i type next time

    Regards, Jamie

+ 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. Exporting one column to text file
    By Brelin in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-21-2008, 12:29 AM
  2. Append Cell Values To Text Files
    By Stefan.S. in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-17-2008, 11:09 AM
  3. How to splitt texts into words? (collecting word and compounds)
    By wali in forum Excel Programming / VBA / Macros
    Replies: 53
    Last Post: 02-03-2008, 04:06 AM
  4. Column of Text - combining terms
    By peterz in forum Excel General
    Replies: 4
    Last Post: 02-12-2007, 08:51 AM
  5. [SOLVED] counting text in a column w/text criteria to other column
    By LnghairdFreak in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-20-2006, 04:37 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