+ Reply to Thread
Results 1 to 7 of 7

VBA Popup to search a sheet and delete rows based on keyword entered

  1. #1
    Registered User
    Join Date
    06-03-2011
    Location
    Providence, RI
    MS-Off Ver
    Excel 2003
    Posts
    4

    VBA Popup to search a sheet and delete rows based on keyword entered

    Hi,
    I am pretty new to VBA, and have been feeling around in the dark trying to figure this out. What I am looking to do is create a macro button that causes a popup (on Sheet 1) , that will ask you what name you want to delete, and have it search a list of names (Sheet 3) and delete the row based upon the keyword search. I really do not even know where to begin, if someone can help get me in the right direction that would be awesome. Thanks!

    Please let me know if I can help provide more information, or if I am unclear as to my needs.
    Last edited by MichaelJG; 06-05-2011 at 06:17 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA Popup to search a sheet and delete rows based on keyword entered

    This should be simple, but for the best solution it would help to see some dta.

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-03-2011
    Location
    Providence, RI
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: VBA Popup to search a sheet and delete rows based on keyword entered

    Thanks for the sound advice,

    Here is the dummy workbook. I know my code looks all crazy for the other things I have going on. (Alphabetization of the names ect.) If you have any suggestions as to running my code more efficiently please feel free to make other suggestions as well.

    But as far as my MAIN CONCERN goes, the popup window would go on the first page where I have the text located, and it would search and clear the contents of the rows on "page 3" (*NOT DELETE*) based on the keyword entered into the popup box.

    Thanks again.
    Attached Files Attached Files
    Last edited by MichaelJG; 06-04-2011 at 08:45 AM.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA Popup to search a sheet and delete rows based on keyword entered

    Are there going to be multiple instances of the same name on Sheet3?
    General:
    You need to remove all the unused UserForms & any empty code modules.
    The code that you have is all recorded & requires tidying up - you don't need Selections, SmallScroll etc

  5. #5
    Registered User
    Join Date
    06-03-2011
    Location
    Providence, RI
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: VBA Popup to search a sheet and delete rows based on keyword entered

    Highly unlikely that there will be several instances of the same name on the third sheet.

    I cleaned up the code alittle bit thanks to your suggestion

    Here is the workbook again, this time without all of the garbage code.

    Thanks!
    Attached Files Attached Files

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA Popup to search a sheet and delete rows based on keyword entered

    I've added a userform to delete the selected row.

    Also I've amended a couple of the codes to show you how to edit the recorfed macro. However, the code will only work on the ranges coded in, if you want it to work on different ranges then a different approach would be needed.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-03-2011
    Location
    Providence, RI
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: VBA Popup to search a sheet and delete rows based on keyword entered

    Ah man, thats perfect!

    Thanks so much RoyUK.

    I just cleaned up the code alittle bit, and its running perfectly now.

    Thanks so much 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)

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