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?
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?
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) :
HTHPlease Login or Register to view this content.
DominicB
Please familiarise yourself with the rules before posting. You can find them here.
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.
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks