+ Reply to Thread
Results 1 to 12 of 12

Delete contents of a cell in a given range if it matches contents of a specific cell

  1. #1
    Registered User
    Join Date
    01-11-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    22

    Delete contents of a cell in a given range if it matches contents of a specific cell

    I am hoping for a simple solution to this problem.

    I need a macro to accomplish the following:

    A name is entered in cell A2. I want to use a button that will trigger a macro that will search a range J5:J50 for that same word and delete it.
    i.e
    This is for a scheduling sheet I am creating. The button would be "delete employee" and it should search a list (J5:J50) for the name currently in A2. Then delete the matching name(s) in (J5:J50). Then clear the name in A2 to prepare for the next entry.

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Delete contents of a cell in a given range if it matches contents of a specific cell

    Please Login or Register  to view this content.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Registered User
    Join Date
    01-11-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    22

    Re: Delete contents of a cell in a given range if it matches contents of a specific cell

    Awesome!!!!!!!!!!!!!!!!!!!!!!!!!!! I was googling for hours! Thanks so much!

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Delete contents of a cell in a given range if it matches contents of a specific cell

    Glad to help. Please mark this thread as solved, and any reputation points, (the star in the lower left of the posts) is appreciated.

  5. #5
    Registered User
    Join Date
    01-11-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    22

    Re: Delete contents of a cell in a given range if it matches contents of a specific cell

    Oh No!!! If the cell A2 is blank, the whole thing crashes... Any Ideas?? Thanks so much!

  6. #6
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Delete contents of a cell in a given range if it matches contents of a specific cell

    You said the name is entered into A2... If there's nothing in A2, what name is it searching for?

  7. #7
    Registered User
    Join Date
    01-11-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    22

    Re: Delete contents of a cell in a given range if it matches contents of a specific cell

    It's a scheduling program. If one of the users accidentally hits the button with no info in A1, it will hang up the program. Is there a way to have a message box appear if there is no item in A2. i.e. "Please Enter Name in Field"?

  8. #8
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Delete contents of a cell in a given range if it matches contents of a specific cell

    Please Login or Register  to view this content.

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

    Re: Delete contents of a cell in a given range if it matches contents of a specific cell

    This should do
    Please Login or Register  to view this content.
    Last edited by jindon; 01-11-2016 at 08:11 PM.

  10. #10
    Registered User
    Join Date
    01-11-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    22

    Re: Delete contents of a cell in a given range if it matches contents of a specific cell

    The Formula works well, although if you click outside the "Please enter name" box, it gets hung up and needs to be shut down with task manager.

    However, when I attempt to copy the formula, (and change the target fields) it won't work for other areas.

    Please take a look at the file I attached. You'll understand what I'm talking about.

    Again. Thank you so much for your assistance!!!!

    Rich
    Attached Files Attached Files

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

    Re: Delete contents of a cell in a given range if it matches contents of a specific cell

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    01-11-2016
    Location
    USA
    MS-Off Ver
    2007
    Posts
    22

    Re: Delete contents of a cell in a given range if it matches contents of a specific cell

    This work!

+ 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] Delete cell contents if the corresponding range is empty
    By zanguard80 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-29-2015, 06:32 PM
  2. Replies: 3
    Last Post: 06-29-2015, 03:03 PM
  3. Delete Rows that contain matching cell contents in column to the contents in cell B1
    By sspatriots in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-23-2015, 05:39 PM
  4. [SOLVED] Macro Delete Contents in 23rd corresponding cell if the cell in range is a non-blank cell
    By murtaza.khan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-04-2014, 01:11 AM
  5. [SOLVED] Return contents of a cell that contains a specific text within a range.
    By nhi in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-04-2013, 07:54 PM
  6. Replies: 4
    Last Post: 03-19-2012, 03:05 PM
  7. Replies: 1
    Last Post: 03-19-2012, 09:43 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