+ Reply to Thread
Results 1 to 4 of 4

Change cell value with checkbox

  1. #1
    Registered User
    Join Date
    02-23-2004
    Location
    amsterdam
    Posts
    7

    Change cell value with checkbox

    from view, toolbars, control toolbox, and check box:
    if I place a checkbox on a excel sheet, how would I code it in VB that when I check the box, value of cell A1 becomes "test" and when I deselect the box the value becomes a empty cell?

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon bazzdaciple

    If your checkbox is on Sheet1 then put this into the code module for Sheet1 (right click sheet tab and select View Code) :

    Please Login or Register  to view this content.
    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    You can also use a formula in A1, instead of code....

    If you use a linked cell to display TRUE/FALSE based on your checkbox...

    then formula in A1 would be =IF(X1,"Test","") where X1 is the linked cell to the checkbox.....note: you link the cell through Properties for the checkbox
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    02-23-2004
    Location
    amsterdam
    Posts
    7
    Thanks both 4 your help. I did infact use the code since the designated cell also needed to be free for manual input. Placing a formula in the cell would make it impossible to manually input text in the cell as this would overwrite the formula. I added the code to the checkbox code and it works perfectly.

+ 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