ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   "Check Marking" a cell (https://www.excelbanter.com/excel-discussion-misc-queries/21215-%22check-marking%22-cell.html)

FVC

"Check Marking" a cell
 
Can I format (via Macro???) a cell so that if the user left clicks on the
cell a check mark appears without using the Control Toolbox. The cells with
such format will only need to then be the totaled (via =counta(x:x).

Dave Peterson

There's no left click you can tie into. You could base it on selection (either
the mouse or the keyboard), but you could use rightclick for this:

If that's ok, rightclick on the worksheet tab that should have this behavior.
Select view code and paste this into that code window:

Option Explicit
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a:a")) Is Nothing Then
Exit Sub
End If

With Target
If IsEmpty(.Value) Then
.Value = Chr(252)
.Font.Name = "Wingdings"
Else
.ClearContents
End If
End With
Cancel = True
End Sub

I used column A (range("a:a")), but you could specify any cells you wanted:

me.range("a1:b3,d9:f12,c:c")
for example.

FVC wrote:

Can I format (via Macro???) a cell so that if the user left clicks on the
cell a check mark appears without using the Control Toolbox. The cells with
such format will only need to then be the totaled (via =counta(x:x).


--

Dave Peterson

David

?B?RlZD?= wrote

Can I format (via Macro???) a cell so that if the user left clicks on
the cell a check mark appears without using the Control Toolbox. The
cells with such format will only need to then be the totaled (via
=counta(x:x).

Something like this in a WorkSheet module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Target.Count 1 Then Exit Sub
With Selection
..Value = Chr(252): .Font.Name = "Wingdings"
End With
End Sub


--
David


All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com