MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Check box/marcos


Posted by Christopher Mains on October 10, 2000 12:01 PM

lets say I have a very simple macro where it will change a cells value from 1 to 0. I assign it to the check box and that works, now lets say I want to change that same cell from 0 to 1. How to I get that one check box. because currently that check box does not place a check in it when selected, it acts more like a button then anything else. any help will be much appreciated.


Posted by Celia on October 10, 2000 7:50 PM


You could use code something like the following and attach to a button :-

If ActiveCell.Value = 0 Then
ActiveCell.Value = 1
Else
If ActiveCell.Value = 1 Then ActiveCell.Value = 0
End If

Celia

Posted by Christopher Mains on October 11, 2000 7:01 AM

Thank you for your help, I had just figured it out just before I checked the board again. I still have a question about the actual object of the check box. Even with the IF...THEN statements it still does not show the check. The people I am making this for are goin to ignore the values they just want to put a check and move on to get a total of the values that the checkboxs create.

Posted by Celia on October 11, 2000 7:11 AM

Don't understand


Christopher
Sorry, don't understand what you are trying to do.
Celia

Posted by Christopher Mains on October 11, 2000 7:33 AM

Re: Don't understand

Sorry, What I need is when the check box is selected to have a check in it, and also send a value to an obscure cell. Right now I have it so it sends the value to the cell but the check box does not show the check. Thank you for your time.
Christopher

Posted by Celia on October 12, 2000 3:57 AM

Re: Don't understand


Christopher
I am assuming that what you want to do is get a count of the check boxes that have a check mark. If so, link each check box to a cell (a different cell for each check box). After doing this, when a check box has a check mark, its linked cell will display TRUE; when the box is un-checked the cell will show FALSE.
Therefore, to count the boxes with check marks :-
=COUNTIF((RangeOfLinkedCells),"True").

It is normally a good idea to place each check box on top of its linked cell, so that the contents of the cells cannot be seen.

Post again if this not what you were looking for.

Celia


Posted by Christopher Mains on October 12, 2000 7:23 AM

Thank you

Celia,
That isn't really what I was looking for but it gave me a great idea. Thank you so much for your time.
Christopher