+ Reply to Thread
Results 1 to 20 of 20

Formula for Deleting Text based on Criteria

  1. #1
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Formula for Deleting Text based on Criteria

    Does anyone know if there's a way to have text on one sheet automatically removed/deleted based on data/criteria entered on another sheet in the same workbook?

    For example, in my attached worksheet I have two sheets, one labeled Values and the other Overall. Both sheets have a list of names, I would like the Overall sheet to have a name and all the data in that row with the name removed/deleted when a value is entered with that same name on the Values sheet.

    Let's say I enter a number value in cell E4 of the Values Sheet for the name Mike Trout, I would then want the name Mike Trout and all his information in that corresponding row removed automatically from the Overall sheet. Is this possible?

    My worksheet is attached, any help would be greatly appreciated. Thanks!
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Formula for Deleting Text based on Criteria

    Right click on the sheet tab and select "View Code"
    Copy and paste the code there.


    Please Login or Register  to view this content.
    Attached Images Attached Images

  3. #3
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: Formula for Deleting Text based on Criteria

    Quote Originally Posted by davesexcel View Post
    Right click on the sheet tab and select "View Code"
    Copy and paste the code there.


    Please Login or Register  to view this content.
    Is this a general code or is this specific to my particular worksheet?

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Formula for Deleting Text based on Criteria

    You will place the code on Values Sheet's module and change the Sheet Name in the code if the other sheet is not "Overall".

    Please Login or Register  to view this content.
    For detail see the attached.
    To view the code --> Right Click on Values Sheet Tab--> View Code
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  5. #5
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: Formula for Deleting Text based on Criteria

    Quote Originally Posted by sktneer View Post
    You will place the code on Values Sheet's module and change the Sheet Name in the code if the other sheet is not "Overall".

    Please Login or Register  to view this content.
    For detail see the attached.
    To view the code --> Right Click on Values Sheet Tab--> View Code
    Opened up the worksheet, entered a value in cell E4 and the player did not delete from the Overall sheet, any ideas?

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Formula for Deleting Text based on Criteria

    Did you enable the macros after opening the file when prompted?

  7. #7
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: Formula for Deleting Text based on Criteria

    Quote Originally Posted by sktneer View Post
    Did you enable the macros after opening the file when prompted?
    Ya now it works. Only issue I'm having is if I enter a value the player deletes, but if I remove the value the player still stays deleted. Anyway to make the player only be deleted if there is a value entered?

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Formula for Deleting Text based on Criteria

    In that case the possible workaround is to hide the row on Overall Sheet rather deleting it. So if you remove the value on the Values Sheet, the row will be visible again.
    See if this is something you can work with.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: Formula for Deleting Text based on Criteria

    Quote Originally Posted by sktneer View Post
    In that case the possible workaround is to hide the row on Overall Sheet rather deleting it. So if you remove the value on the Values Sheet, the row will be visible again.
    See if this is something you can work with.
    That works but is there anyway to make the popups go away every time you enter a value or delete a value?

  10. #10
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Formula for Deleting Text based on Criteria

    Just delete the lines in the code which start with Msgbox "...............". There are two such lines in the code.

  11. #11
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: Formula for Deleting Text based on Criteria

    Quote Originally Posted by sktneer View Post
    Just delete the lines in the code which start with Msgbox "...............". There are two such lines in the code.
    Ok that worked thanks. If I wanted to apply this to more than one sheet at a time would I just add more sheets in the code and where?

  12. #12
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: Formula for Deleting Text based on Criteria

    Quote Originally Posted by mlbdc2012 View Post
    Ok that worked thanks. If I wanted to apply this to more than one sheet at a time would I just add more sheets in the code and where?
    Can anyone help with this?

  13. #13
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Formula for Deleting Text based on Criteria

    Your requirement is not clear.
    What do you mean by adding more sheets? Will you have one Overall sheet with more than one Value sheets or you will have one Value sheet with more than one Overall Sheets?

  14. #14
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: Formula for Deleting Text based on Criteria

    Quote Originally Posted by sktneer View Post
    Your requirement is not clear.
    What do you mean by adding more sheets? Will you have one Overall sheet with more than one Value sheets or you will have one Value sheet with more than one Overall Sheets?
    One Values Sheet with multiple Overall sheets with the names on each one

  15. #15
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Formula for Deleting Text based on Criteria

    Replace the previous Worksheet_Change code with this one.....
    Please Login or Register  to view this content.
    Does this resolve your issue?

  16. #16
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: Formula for Deleting Text based on Criteria

    Quote Originally Posted by sktneer View Post
    Replace the previous Worksheet_Change code with this one.....
    Please Login or Register  to view this content.
    Does this resolve your issue?
    Yes this allows more than one sheet to have the code to apply to, but I would like the ability to choose which sheets to apply it to, I don't want them all to have it just the sheets I pick.

  17. #17
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Formula for Deleting Text based on Criteria

    Try this.....
    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: Formula for Deleting Text based on Criteria

    Quote Originally Posted by sktneer View Post
    Try this.....
    Please Login or Register  to view this content.
    Ok so what if I want to use more than one sheet, do i use a comma and then quotations?

  19. #19
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Formula for Deleting Text based on Criteria

    Don't quote whole posts -- it's just clutter. If you are responding to a post out of sequence, limit quoted content to a few relevant lines that makes clear to whom and what you are responding.

    Moreover its better for you to decide what do you want actually in prior to ask someone to suggest a code. Its just a waste of time for anyone to change the code every time with your if's and but's.
    Writing codes takes time and I don't have that much of time to do that and I am really sorry to say but personally I don't prefer to attempt such threads.


    Take Care.

  20. #20
    Forum Contributor
    Join Date
    11-23-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2013
    Posts
    457

    Re: Formula for Deleting Text based on Criteria

    Alright thanks!

+ 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] Deleting rows based on criteria.
    By nighttrainrex in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-09-2013, 12:48 AM
  2. [SOLVED] Deleting rows based on two criteria
    By safesearcher in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 01-31-2013, 12:54 PM
  3. deleting rows based on criteria
    By scubadude47 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-14-2008, 01:53 PM
  4. Deleting rows based on criteria
    By MJK in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-16-2008, 08:45 AM
  5. Deleting Rows based on criteria...
    By neilcarden in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-09-2007, 05:23 PM

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