Excel - Click a cell and insert a wingding

December 2016




Issue


In excel I am wanting to be able to click a cell to insert a Selected wingding from a list.
But to also beable to click the cell a second time to change to another wingding.
I am trying to create a Tick and cross function for a Checklist. Click once to input a tick click twice input a cross click thrice and cell is cleared.
I have seen this tht was used to change the color of the cell on click and am having trouble working out if I can modify it or need something completely different.


Private Sub Worksheet_SelectionChange(ByVal Target As Range) 

With Target 
If Intersect(.Cells, Columns(2)) Is Nothing Or .Count > 1 Then Exit Sub 
Select Case .Value 
Case "" 
.Interior.ColorIndex = 10 
Case 1 
.Interior.ColorIndex = 6 
Case 2 
.Interior.ColorIndex = 2 
Case 3 
.Interior.ColorIndex = xlNone 
.Value = vbNullString 
Exit Sub 
Case Else 
Exit Sub 
End Select 
.Value = .Value + 1 
End With 

End Sub 

Solution


You are on the right path


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    With Target
        If Intersect(.Cells, Columns(2)) Is Nothing Or .Count > 1 Then Exit Sub
        
            Selection.Font.Name = "Wingdings"
        
            Select Case .Value
            
                'if blank,then put checkmark
                Case ""
                    .Value = "û" ' checkmark character in wingding
                
                'if checkmark, then put cross
                Case Is = "û"
                    .Value = "ü" ' cross mark character in wingding
                
                'if cross, then clear
                Case Is = "û"
                    .Value = ""
                
                'default
                Case Else
                    
                    .Value = ""
            
            End Select

    End With

Note


Thanks to rizvisa1 for this tip on the forum.

Related :

This document entitled « Excel - Click a cell and insert a wingding » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.