+ Reply to Thread
Results 1 to 6 of 6

Macro to delete unwanted items

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,722

    Macro to delete unwanted items

    I have written code to delete unwanted items in Col B on sheet1 containing certain text below (have highlighted the items to be deleted in yellow)

    INTERBRANCH TRFS
    sample Trf

    Please Login or Register  to view this content.

    when running the macro none of the items highlighted are deleted


    It would be appreciated if someone could assist me
    Attached Files Attached Files

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

    Re: Macro to delete unwanted items

    Please Login or Register  to view this content.

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: Macro to delete unwanted items

    Good morning Howardc1001

    Try the following :

    Please Login or Register  to view this content.

    Note that :
    • The * before Sample TRF is important - it's a wildcard
    • The "Like" operator IS case sensitive, so "Sample TRF" is not the same as "Sample trf"
    • The "INTERBRANCH TRFS" line won't work, bacause that isn't what appears in your workbook.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  4. #4
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,722

    Re: Macro to delete unwanted items

    Hi Dominicb


    thanks for the help and your input


    How can I amend the case so it accepts upper, lower and proper case ?

  5. #5
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: Macro to delete unwanted items

    Hi Howardc1001

    Change your comparator to upper case, and then use UCase in your code to make your string uppercase, for the check only. The line would then look like :

    Please Login or Register  to view this content.
    HTH

    DominicB

  6. #6
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,722

    Re: Macro to delete unwanted items

    Thanks for letting me know

+ 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] Macro/VBA code to Filter and delete unwanted data
    By robertguy in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-29-2018, 11:40 PM
  2. [SOLVED] Macro to Delete Unwanted Worksheets
    By robertguy in forum Excel General
    Replies: 6
    Last Post: 11-29-2017, 07:37 AM
  3. Delete unwanted items in a column and joining values together
    By AndyDzul18 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 08-09-2017, 07:52 PM
  4. [SOLVED] A Macro to Delete Unwanted Columns
    By newbieexceldude in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-25-2016, 10:36 PM
  5. Macro to filter on unwanted data and delete
    By robertguy in forum Excel General
    Replies: 1
    Last Post: 12-07-2016, 02:31 PM
  6. Macro to delete unwanted data
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-22-2007, 04:05 AM
  7. [SOLVED] I need a macro to delete unwanted data
    By Jason in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-25-2005, 07:06 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