+ Reply to Thread
Results 1 to 6 of 6

Formula for an Automatic Cell Deletion

  1. #1
    Forum Contributor
    Join Date
    03-20-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    108

    Formula for an Automatic Cell Deletion

    Is it possible to write a formula that when something is entered into a cell, another cell will automatically delete (instead of manually deleting the other cell)?

    For example, when a cell under let's say column Date#2 is entered, the corresponding date next to it under Date#1 will automatically delete.

    Any help is appreciated. Thank you.

  2. #2
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: Formula for an Automatic Cell Deletion

    Assuming A1 is where you enter the value and B2 is the value that needs to be removed, type into B2:

    =IF(A1="",YOURVALUE,"")

    Or change the format of the cell to make the cell appear blank (e.g white font if cell fill is white) then apply conditional formatting to the cell =A1="" and set the font to a colour that would be visible.
    Say thanks, click *

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Formula for an Automatic Cell Deletion

    Formulas cannot clear the contents of other cells. As Harri suggested, you can have a formula which looks at another cell and populates itself depending on whats in that other cell (or cells) but if you are manually entering dates, you'll need to use VBA (Visual Basic for Applications Programming language) to clear that other cell. Would you want to do that?

    Harri's second suggestion of using conditional formatting to hide the contents of the first cell, would work if you are just looking for a visual solution.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Forum Contributor
    Join Date
    03-20-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Formula for an Automatic Cell Deletion

    I don't need to hide the contents of the cell, I need to delete the contents of the cell.

    How would I do that using VBA?

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Formula for an Automatic Cell Deletion

    Right click on the worksheet tab and "View Code"
    This will open the VBA editor
    Paste this code into the VBA Editor
    Please Login or Register  to view this content.
    Modify the range to reflect the range of cells where you will be entering data (not the column which you want to clear)
    Did that work for you?

  6. #6
    Forum Contributor
    Join Date
    03-20-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Formula for an Automatic Cell Deletion

    Thank you. It worked!
    Last edited by rowena229; 03-22-2013 at 11:40 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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