+ Reply to Thread
Results 1 to 6 of 6

Macro to retain only certain items

  1. #1
    Spammer
    Join Date
    08-20-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    221

    Macro to retain only certain items

    I have suppliers in Col A and want to retain the following in Col A where it contains the following in the text


    Probank
    Credit
    Finance



    It have highlighted the items in yellow to retain. The balance of the rows to be deleted


    It would be appreciated if someone could provide be with the code to do this
    Attached Files Attached Files
    Last edited by flupsie; 12-15-2017 at 10:43 PM.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Macro to retain only certain items

    hi there. try this:
    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Macro to retain only certain items

    AdvancedFilter
    Please Login or Register  to view this content.

  4. #4
    Spammer
    Join Date
    08-20-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    221

    Re: Macro to retain only certain items

    Thanks for the help. Kindly amend the code Instr to accept either lower or upper code in the string for eg Probank, probank, Credit, credit etc

  5. #5
    Spammer
    Join Date
    08-20-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    221

    Re: Macro to retain only certain items

    Managed to sort it out by removing Lcase

  6. #6
    Spammer
    Join Date
    08-20-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    221

    Re: Macro to retain only certain items

    Thanks for the help

+ 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. Altering the 'number of items to retain per field' pivottable setting with VBA?
    By TheClaw2323 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-29-2016, 06:55 AM
  2. Retain cell formatting when running Sort macro?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-07-2013, 08:58 AM
  3. Macro to retain a formula and overwrite when needed
    By lefeu in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-09-2013, 07:25 AM
  4. Replies: 5
    Last Post: 02-21-2013, 11:37 AM
  5. Macro to save to PDF and retain 11x17 landscape
    By Dougl in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-07-2012, 06:52 PM
  6. Pivot doesn't retain number formatting from macro
    By smokebreak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-03-2010, 04:51 PM
  7. Retain the Value of a Variable in Macro
    By blueperfume300 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-07-2007, 04:19 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