How do I: enter a checkmark symbol in a cell by clicking on it

P

prsII

This is what I am trying to do....

1. When someone clicks on cell, the checkmark symbol is entered into
the cell

2. When someone clicks on the same cell again, they cell becomes blank
(ie toggle between checkmark and blank)

3. Then how do I count the number of checkmarks in a column.

Thanks,
 
G

Guest

How about a double-click?:
Enter the following in worksheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
Cancel = True
Dim s As String
Application.EnableEvents = False
s = Chr(252)
If Target.Value = "" Then
Target.Value = s
Target.Font.Name = "Wingdings"
Else
Target.Value = ""
End If
Application.EnableEvents = True
End Sub

This assumes only checks or blanks. If you double-click a blank, a
checkmark is entered.

If you double-click a non-blank, it is cleared.

To count checkmarks in a column, use something like:
=COUNTIF(C1:C5,"=" & CHAR(252))
 
P

Paul B

prsII, another way for only one column with one click

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Have a Cell Ticked Upon Selection
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("A:A")) Is Nothing Then
Target.Font.Name = "Marlett"
If Target = vbNullString Then
Target = "a"
Else
Target = vbNullString
End If
End If
End Sub

this is worksheet code

To put in this macro right click on the worksheet tab and view code, in the
window that opens paste this code, press Alt and Q to close this window and
go back to your workbook. If you are using excel 2000 or newer you may have
to change the macro security settings to get the macro to run. To change the
security settings go to tools, macro, security, security level and set it to
medium

and to count them

=COUNTIF(A:A,"a")



--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
P

Paul

What changes are needed if instead of inserting (counting) checkmarks, I
wanted the cell color to changed to green or red and count the number of
green or red cells.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top