+ Reply to Thread
Results 1 to 5 of 5

Clear a cell when Tick box is ticked

  1. #1
    Forum Contributor
    Join Date
    10-08-2013
    Location
    End of the World, USA
    MS-Off Ver
    EXCEL 2007
    Posts
    111

    Clear a cell when Tick box is ticked

    How do I clear Cell B5 only when A tick box is ticked that I created?

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Clear a cell when Tick box is ticked

    I assume you're using a Checkbox control from the ActiveX objects (Developer Ribbon > Controls > Insert > ActiveX). If so, in Design Mode double-click the checkbox to open the code editor for that object and add the following code:
    Please Login or Register  to view this content.
    Close the VBA Editor and take the checkbox out of Design Mode (on the Developer ribbon).

    This will do exactly what you said, even if you unintentionally check the box. If you subsequently un-check it, nothing happens. (e.g. It doesn't undo the previous action.) If the checkbox is already checked, and you un-check it, that will also clear cell B5 since this code simply pertains to the click event. Additional code can be used to determine what to do when the checkbox is checked vs. unchecked, or prompt you for confirmation, etc.

  3. #3
    Forum Contributor
    Join Date
    10-08-2013
    Location
    End of the World, USA
    MS-Off Ver
    EXCEL 2007
    Posts
    111

    Re: Clear a cell when Tick box is ticked

    can I simply put that Private Sub into my Sub?

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Clear a cell when Tick box is ticked

    If you already have code for the checkbox in question, sure. Just add the actual line of code (middle), not the Private Sub or End Sub lines.

  5. #5
    Forum Contributor
    Join Date
    10-08-2013
    Location
    End of the World, USA
    MS-Off Ver
    EXCEL 2007
    Posts
    111

    Re: Clear a cell when Tick box is ticked

    If I only enter

    Please Login or Register  to view this content.
    in my sub with other content it will always clear, how do I only clear when that box is ticked?

+ 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 Checkbox is Ticked and Cell has Value then Run Macro
    By Heavenkissing in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-12-2011, 10:34 AM
  2. Using Togglebutton to to clear all ticked Checkboxes on a different worksheet.
    By Skelvissie in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-30-2011, 08:29 PM
  3. make a tick box only tickable if another is ticked
    By regithier in forum Excel General
    Replies: 1
    Last Post: 02-27-2009, 12:34 PM
  4. Macro To clear tick boxes
    By jamie.c in forum Excel General
    Replies: 4
    Last Post: 05-21-2007, 04:34 AM
  5. [SOLVED] VBA for put cell C2 in overstrike/black when B2 checkbox is ticked?
    By StargateFan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-14-2005, 11:06 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