+ Reply to Thread
Results 1 to 6 of 6

Delete cell contents if another cell is blank

  1. #1
    Registered User
    Join Date
    11-23-2010
    Location
    Leicester, England
    MS-Off Ver
    Excel 2021 Pro Plus
    Posts
    87

    Delete cell contents if another cell is blank

    Hi, I daily download data into a spreadsheet and I need to be able to delete the contents of one particular cell if another particular cell has no data in it.
    The cells are in the same row as each other, but the actual row number can change depending on how many rows of data the download contains.
    The columns that these cells appear in are always constant.

    I need a macro function that will look at the whole worksheet and repeat this process wherever it finds this condition.

    For example, if cell L4 is blank, then delete the contents of cell U4. Then repeat this for the rest of the worksheet.
    Cols L and U will always be where the cells reside but the rows could be anywhere. The worksheet range is from A1 to AN400

    The sheet is overwritten daily by the new download so I can't use a formula stored in a cell.

    I already have a macro that performs other formatting on the sheet, so I need to add code to the beginning of the existing macro.

    Sorry for the long message but I tried to be as descriptive as possible.
    Thanks in advance for any help
    Mike
    Last edited by MikeWaring; 11-24-2010 at 04:15 AM.

  2. #2
    Forum Contributor
    Join Date
    08-04-2010
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    143

    Re: Delete cell contents if another cell is blank

    Hi, you can try this.
    Please Login or Register  to view this content.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Delete cell contents if another cell is blank

    Assuming the cells are truly blank

    Please Login or Register  to view this content.
    modify sheet name accordingly

  4. #4
    Registered User
    Join Date
    11-23-2010
    Location
    Leicester, England
    MS-Off Ver
    Excel 2021 Pro Plus
    Posts
    87

    Re: Delete cell contents if another cell is blank

    Hi both, Thanks for the extremely prompt replies. Both of the suggested macros work fine!
    Thanks again.

  5. #5
    Registered User
    Join Date
    07-06-2015
    Location
    orange county, ca
    MS-Off Ver
    2010
    Posts
    1

    Re: Delete cell contents if another cell is blank

    If I wanted to delete the contents of multiple cells, how would this be written? If the sample above is used, say I wanted to delete the contents of U4, V4, W4, how can I input this range instead of 1 cell?

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,945

    Re: Delete cell contents if another cell is blank

    hi bzk, welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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