+ Reply to Thread
Results 1 to 2 of 2

Delete All Rows except for user specified input

  1. #1
    Registered User
    Join Date
    06-27-2014
    Location
    Canada
    MS-Off Ver
    Version 2309, Microsoft 365
    Posts
    1

    Exclamation Delete All Rows except for user specified input

    Dear All,

    I am writing in this forum to seek help from all of you . I am quite new to macros and have little understanding except for copy pasting the code into the developer tab.
    I need some help with deleting all rows in an excel file except for 3 strings provided by the user.
    All the information is available in column A of my excel spreadsheet which as about 80K records.
    Column A contains customer names and some customers are known a little differently. For example Customer Name, Customer.Name, Customer Name Inc etc. This is all text.

    So, the requirement is for a macro code as below :
    1. Provide a input box or any other way to capture the user inputs. The user should be able to provide 3 inputs separated by comma
    2. Once the inputs are provided, the code runs and finds all inputs in column A of the spreadsheet and deletes ALL rows EXCEPT for the rows which match the inputs provided by the user. The first row has the headers show it should be retained.
    3. Code needs to be fast knowing that the excel file has about 80 K records to look out for .

    You may suggest that I should use the filter, but that is what I have been doing so far. The problem with using the filter is that I may not be using the file always. It could be someone else who isn't well versed with filters and excel. So any automation efforts will help.

    Thank you everyone for your help in advance.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,703

    Re: Delete All Rows except for user specified input

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. Macro to delete rows based on a value using user input box
    By AditiM in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-16-2020, 01:10 PM
  2. [SOLVED] VBA to delete rows based on user input
    By Roux11 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-27-2020, 11:40 AM
  3. [SOLVED] Delete specific number of rows for each column with user input
    By Sriramroxx in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-22-2019, 11:28 AM
  4. [SOLVED] Delete specific data from (x) new rows added as defined by user through input box
    By Jaysk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2017, 12:41 AM
  5. [SOLVED] Help required - User input for text search and delete remaining rows
    By ssss2005 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-20-2015, 11:06 AM
  6. Automatically Add/Delete rows based on user input but check current table row count
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-31-2011, 11:39 AM
  7. Delete rows based on user input
    By Militia in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-10-2009, 06:33 AM

Tags for this Thread

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