Adding a checkmark in Microsoft and MacOS Excel

Robert_Conklin

Board Regular
Joined
Jun 19, 2017
Messages
177
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I work from both Microsoft and MacOS platforms. I am in need of a macro that will add a checkmark to a cell easily. I have tried using code from a previous request "Using VBA in EXCEL to add a checkmark to a cell" but it will not work on my new Microsoft machine and I am not sure it will work on my Mac. Thank you in advance for any assistance.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
To add a checkmark to a cell easily, please try the following on a copy of your workbook. Put the code in the relevant worksheet's code module. Works via a double click on the mouse.
You can easily change the font etc. to suit your preferences.

VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, cancel As Boolean)
    Application.EnableEvents = False
        cancel = True
        With ActiveCell
            .Value = "ü"
            .HorizontalAlignment = xlCenter
            With .Font
                .Name = "Wingdings"
                .Size = 18
                .Color = vbBlack
                .Bold = True
            End With
        End With
    Application.EnableEvents = True
End Sub
 
Upvote 1
Good morning, Kevin9999.

Thank you for the code. It works as described but leaves another problem. If I want to edit another cell, I cannot double click into it and make the changes.
 
Upvote 0
We can restrict the code to only work in specific columns if that's any help?
 
Upvote 0
Hi you can try the below :
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Not Intersect(Target, Range("A1:A10")) Is Nothing Then 'change the range as per your requirement
        Application.EnableEvents = False
        If ActiveCell.Value = ChrW(&H2713) Then
            ActiveCell.ClearContents
        Else
            ActiveCell.Value = ChrW(&H2713)
        End If
        Cancel = True
    End If
    Application.EnableEvents = True
End Sub
 
Upvote 1
Solution
Thank you kevin9999 and Sanjeev1976. That works. Just so I am clear, anytime I have a sheet that will require the checkmark, I will need to add this code to the sheet code. Is that correct?
 
Upvote 0
Thanks for your feedback and yes you need to add this to the sheet code, whenever you need it in other files
 
Upvote 1

Forum statistics

Threads
1,226,460
Messages
6,191,165
Members
453,643
Latest member
adamb83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top