+ Reply to Thread
Results 1 to 12 of 12

Macro to delete certain items in Col B

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

    Macro to delete certain items in Col B

    I have a macro the deletes rows in Col b containing

    I would like to neaten the code by putting the criteria for items to be deleted in an array so one can add more items to be deleted if necessary
    Please Login or Register  to view this content.

    your assistance is most appreciated
    Last edited by Howardc1001; 01-30-2020 at 08:48 AM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to delete certain items in Col B

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 01-30-2020 at 05:52 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

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

    Re: Macro to delete certain items in Col B

    Thanks for the helping in improving my code making it easier to add additional items to be deleted if necessary

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

    Re: Macro to delete certain items in Col B

    In testing the code I get an error message variable not defined

    Please Login or Register  to view this content.
    I then set up Dim As a variant



    I then run the macro and get variable not defined and it refers to code below

    Please Login or Register  to view this content.

    It would be appreciated if you could kindly amend the code

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

    Re: Macro to delete certain items in Col B

    What happens if you Dim Count As Long?
    And I think it should be
    Please Login or Register  to view this content.
    Last edited by jolivanes; 01-31-2020 at 02:06 AM.

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,420

    Re: Macro to delete certain items in Col B

    Here is a different macro that you can try (it is a little bit more compact and, untested, but I think it might be faster as well)...
    Please Login or Register  to view this content.
    Note: Add items to the red highlighted comma/space delimited list as needed
    Last edited by Rick Rothstein; 01-31-2020 at 02:17 AM.

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

    Re: Macro to delete certain items in Col B

    Thanks for the help Rick

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

    Re: Macro to delete certain items in Col B

    thanks for you input jolivanes

    I have set up the variables and not get a compile error :expected array


    Please Login or Register  to view this content.

  9. #9
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,420

    Re: Macro to delete certain items in Col B

    Quote Originally Posted by Howardc1001 View Post
    Thanks for the help Rick
    Did my code work for you?

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

    Re: Macro to delete certain items in Col B

    Hi Rick

    thanks -Your code worked perfectly and very fast

  11. #11
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,420

    Re: Macro to delete certain items in Col B

    Quote Originally Posted by Howardc1001 View Post
    Your code worked perfectly...
    Okay, great! (I wasn't sure if you were just thanking me for participating or if you were thanking me because my code worked.)

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

    Re: Macro to delete certain items in Col B

    I thanked you for your code that worked perfectly

    Hope you have a great day Rick

+ 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 to delete certain items then count remaining items #2
    By elgato74 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-21-2019, 02:26 PM
  2. [SOLVED] Macro to delete certain items then count remaining items
    By elgato74 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-14-2019, 03:20 PM
  3. Macro to delete items contain 1 and less
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-08-2019, 06:20 PM
  4. [SOLVED] Macro to delete unwanted items
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-07-2019, 05:57 AM
  5. [SOLVED] Macro to delete all Duplicate items in Col B
    By flupsie in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-14-2018, 10:21 PM
  6. [SOLVED] Macro to Delete Rows and Renumber Items after
    By jaredmccullough in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-15-2014, 03:49 PM
  7. [SOLVED] Macro for Excel to add up items and delete extra lines?
    By Fiero84 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2005, 10:05 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