+ Reply to Thread
Results 1 to 5 of 5

Delete cell contents if the corresponding range is empty

  1. #1
    Registered User
    Join Date
    02-02-2014
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    37

    Delete cell contents if the corresponding range is empty

    Title clarification: Delete cell contents if the corresponding row range is empty

    Hello, I currently have this code:

    Please Login or Register  to view this content.
    Whenever a cell is changed in rows 3:750 the date is added to the cell in the corresponding row if the column header contains "Date Last Modified". For example, if I changed cell E14 and the header of column T were "Date Last Modified", cell T14 would be filled with today's date.

    My problem: if the rows between column C and the column containing "Date Last Modified" are empty, I would like the corresponding cell in column T to also be empty. Continuing the example, if I deleted everything in C14:S14, the date that was previously added to T14 would be removed. It should only ever be there if something between C14:S14 contains data.

    I've attached an example spreadsheet. Thanks!

    Example spreadsheet.xlsb

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Delete cell contents if the corresponding range is empty

    Note: It can be dangerous having such an open worksheet_change event

    Please Login or Register  to view this content.
    If you are happy with my response please click the * in the lower left of my post.

  3. #3
    Registered User
    Join Date
    02-02-2014
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    37

    Re: Delete cell contents if the corresponding range is empty

    Quote Originally Posted by stnkynts View Post
    Note: It can be dangerous having such an open worksheet_change event
    Could you elaborate on this please? I'm unfamiliar with VBA.

    Please Login or Register  to view this content.
    Thanks for this. Is there a way of making it only activate when changes are made between rows 3 and 750 inclusive?

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Delete cell contents if the corresponding range is empty

    Could you elaborate on this please?
    By not confining it to certain ranges any change in any range will trigger and event which can affect performance and sheet viability. Usually the more confined the range the better.

    Is there a way of making it only activate when changes are made between rows 3 and 750 inclusive?
    Like this:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-02-2014
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    37

    Re: Delete cell contents if the corresponding range is empty

    Many thanks for your help!

+ 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] VBA macro, move cell contents, duplicate down if additional value, delete empty rows
    By lengwer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-07-2015, 10:46 AM
  2. 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
  3. Replies: 1
    Last Post: 05-26-2014, 01:31 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. How to delete entire row if first cell of it is empty for specific range and worksheets
    By roshanvmech in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-01-2014, 12:36 PM
  6. [SOLVED] Macro to delete entire row (within a specified range) if cell in column A is empty
    By instinctellekt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-07-2012, 10:01 AM
  7. find <> empty cell in range, delete entire row
    By Shell_ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-26-2011, 12:36 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