+ Reply to Thread
Results 1 to 9 of 9

If value is blank, delete content in selected cell

  1. #1
    Forum Contributor
    Join Date
    06-01-2012
    Location
    va
    MS-Off Ver
    2007
    Posts
    163

    If value is blank, delete content in selected cell

    I have a workbook where in column A I have a left statement =Left(B24,3) it gives me like 101, but if there is nothing it is blank, which is what I want. But then there is a macro which takes into account anything in column A and even though the cell is blank there is a formula in there. So, I was wondering if there is any formula that could change that so that the cell's contents would be cleared if there is no value in B24

    Thanks!
    Last edited by thelegazy; 07-25-2013 at 11:35 AM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,711

    Re: If value is blank, delete content in selected cell

    No. A formula can only act on the cell it is in - it can't "push" data to another cell. Why don't you amend your macro to scan through the cells in column A first, and if any contain "" as a result of the formula then empty the contents?

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    06-01-2012
    Location
    va
    MS-Off Ver
    2007
    Posts
    163

    Re: If value is blank, delete content in selected cell

    Would you happen to have a macro for that? Or should I start a new thread in the macro section?

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,711

    Re: If value is blank, delete content in selected cell

    No, I don't have one.

    Pete

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: If value is blank, delete content in selected cell

    Alternatively, if you're pressed for time you could change the original formula to output "xxx" instead of "", and then Ctrl+F to find and replace all xxx with nothing.

    But I'd go with modifying the macro because you may even be able to keep the cells as is and evaluate each cell for >0 or <> "" before taking into account the macro action.

  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,929

    Re: If value is blank, delete content in selected cell

    You need VBA for this, so I will move the thread to that forum
    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

  7. #7
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: If value is blank, delete content in selected cell

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    06-01-2012
    Location
    va
    MS-Off Ver
    2007
    Posts
    163

    Re: If value is blank, delete content in selected cell

    Quote Originally Posted by Leon V (AW) View Post
    Please Login or Register  to view this content.
    Ignore Cell if it is blank (but still has formula)
    I have the following code



    Please Login or Register  to view this content.
    Which will comb through the range and if there is any value it will make a section, but I have a LEFT formula in that range and if it doesn't return a value it still takes it into consideration because there is a value. How do I change it to take cells only that show values (not that show nothing, but still have formulas?

    How would i incorporate it into that code?

  9. #9
    Forum Contributor
    Join Date
    06-01-2012
    Location
    va
    MS-Off Ver
    2007
    Posts
    163

    Re: If value is blank, delete content in selected cell

    Quote Originally Posted by Leon V (AW) View Post
    Please Login or Register  to view this content.
    It worked thanks so much!!

+ 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. IF same CONTENT FOUND IN CELL A THEN DELETE CONTENT IN B,C or D
    By mecutemecute in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-11-2013, 01:16 AM
  2. Return the content of a user selected cell.......THX
    By FireTheft in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-16-2012, 07:18 AM
  3. [SOLVED] delete cell content when other cell's content is removed
    By Pretpik in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-11-2012, 11:06 PM
  4. Delete cell content if another cell is blank
    By thuddleston11 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-10-2012, 11:25 PM
  5. Replies: 2
    Last Post: 08-28-2011, 02:39 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