+ Reply to Thread
Results 1 to 6 of 6

ClearContents of particular cells if the contents of another cell is deleted

  1. #1
    Registered User
    Join Date
    04-08-2015
    Location
    Batangas, Philippines
    MS-Off Ver
    2013
    Posts
    3

    Unhappy ClearContents of particular cells if the contents of another cell is deleted

    Hi everyone,

    Can someone help me with my problem? I am actually new to vba.


    I want to automatically clear the contents of certain cells if the contents of "B15" is deleted. It is working, but the problem is whenever I delete the contents of "O7" or "O8". It will also clear the cells. This should not happen. Please help me.

    BELOW IS THE CODES;


    Please Login or Register  to view this content.
    Last edited by alansidman; 04-08-2015 at 04:00 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,617

    Re: ClearContents of particular cells if the contents of another cell is deleted

    Think this
    Please Login or Register  to view this content.
    needs to be this
    Please Login or Register  to view this content.

    Otherwise, you are comparing the values of the cells. And, if B15 is blank ...


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,800

    Re: ClearContents of particular cells if the contents of another cell is deleted

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    04-08-2015
    Location
    Batangas, Philippines
    MS-Off Ver
    2013
    Posts
    3

    Re: ClearContents of particular cells if the contents of another cell is deleted

    Quote Originally Posted by alansidman View Post
    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

    Im sorry, I didn't consider that. Thanks for the reminder

  5. #5
    Registered User
    Join Date
    04-08-2015
    Location
    Batangas, Philippines
    MS-Off Ver
    2013
    Posts
    3

    Re: ClearContents of particular cells if the contents of another cell is deleted

    Quote Originally Posted by TMS View Post
    Think this
    Please Login or Register  to view this content.
    needs to be this
    Please Login or Register  to view this content.

    Otherwise, you are comparing the values of the cells. And, if B15 is blank ...


    Regards, TMS
    Thank you so much TMS for your help. I works fine

    I cant believe it. the only word missing is Adress! haha.,.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,617

    Re: ClearContents of particular cells if the contents of another cell is deleted

    You're welcome.

    But it makes a big difference. The default property for a range, I believe, is Value. So, in your original code, you are comparing the values in two cells, not the addresses of those two cells.


    Regards, TMS

+ 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. Replies: 5
    Last Post: 02-10-2013, 07:59 AM
  2. Clear contents in one cell when contents of another cell are deleted
    By rlbush2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2012, 10:29 PM
  3. type mismatch on cell contents. Cell.clearcontents
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-07-2012, 02:33 AM
  4. Automatically delete cell contents if 1 cell deleted
    By BudParker in forum Excel General
    Replies: 2
    Last Post: 11-08-2009, 11:20 AM
  5. Replies: 2
    Last Post: 08-22-2006, 10:05 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