View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Click on a cell and have check mark displayed in MS Excel

Needs to be a Double click so that it will fire an event on Double Click.
Can't do it on single click.

Copy the following code into the Sheet module in the VBA editor. If you need
instructions to do this then get back to me.

Edit the range "A1:G10" to the range that you want to use for the
check marks to be inserted/deleted.

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)

Dim isect As Object

'Test if target in required range
Set isect = Application.Intersect(Target, Range("A1:G10"))

If Not isect Is Nothing Then
'Cancel Edit mode invoked by double click
Cancel = True

'Test if cell already contains check mark
If ActiveCell = Chr(252) Then
'Clear check mark
ActiveCell.ClearContents
Else
'Insert check mark code
ActiveCell = Chr(252)
'Change font to Wingdings
With ActiveCell.Characters _
(Start:=1, Length:=1).Font

.Name = "Wingdings"

End With
End If
End If

End Sub

--
Regards,

OssieMac


"ogopogo5" wrote:

I would like to be able to click on a cell and have a check mark
displayed in a cell. Then click on the cell again to disappear. Also
indicate what cell range will display the check mark.

Thank you in advance.



*** Sent via Developersdex http://www.developersdex.com ***