Ga naar hoofdinhoud

Hoe voeg ik een vinkje toe in een cel door te dubbelklikken in Excel?

Normaal gesproken moet u voor het invoegen van een vinkje in een cel het dialoogvenster Symbool openen, het vinkje zoeken en het handmatig invoegen. Maar het is niet zo eenvoudig om het vinkje in het dialoogvenster Symbool te vinden, omdat er talloze symbolen in staan. Hoe voeg ik snel een vinkje toe aan een cel in Excel? Dit artikel toont u een VBA-methode om eenvoudig een vinkje in een cel toe te voegen door alleen te dubbelklikken.

Dubbelklik om een ​​vinkje toe te voegen in een cel met VBA-code


Dubbelklik om een ​​vinkje toe te voegen in een cel met VBA-code

De volgende VBA-code kan u helpen een vinkje in een cel toe te voegen door te dubbelklikken. Ga als volgt te werk.

1. Open het werkblad waarvoor u een vinkje in de cel wilt plaatsen, klik met de rechtermuisknop en selecteer Bekijk code vanuit het rechtsklikmenu.

2. In de Microsoft Visual Basic voor toepassingen -venster, kopieer en plak de onderstaande VBA-code in het Code venster.

VBA-code: dubbelklik om een ​​vinkje in een cel te plaatsen

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Not Intersect(Target, Range("B1:B10")) Is Nothing Then
        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

Note: In de code is B1: B10 het bereik dat u door dubbelklikken wilt aanvinken. Wijzig het op basis van uw behoefte.

3. druk de anders + Q toetsen om de Microsoft Visual Basic voor toepassingen venster en keer terug naar het werkblad.

Dubbelklik nu op een cel in het bereik B1: B10, het vinkje wordt automatisch ingevoerd. En als u nogmaals op de cel dubbelklikt, wordt het ingevoegde vinkje verwijderd.

Als u de vinkjes vaak moet gebruiken in uw dagelijkse Excel-werk, raad ik hier de Auto-tekst Nut van Kutools for Excel. Met deze functie kunt u een vinkje opslaan als automatische tekstinvoer en deze in de toekomst opnieuw plaatsen met slechts één klik in Excel, zoals de onderstaande demo laat zien.
Download en probeer het nu! (30 dagen gratis proefperiode)


Gerelateerde artikelen:

Beste Office-productiviteitstools

🤖 Kutools AI-assistent: Een revolutie teweegbrengen in de data-analyse op basis van: Intelligente uitvoering   |  Genereer code  |  Aangepaste formules maken  |  Analyseer gegevens en genereer grafieken  |  Roep Kutools-functies aan...
Populaire functies: Zoek, markeer of identificeer duplicaten   |  Verwijder lege rijen   |  Combineer kolommen of cellen zonder gegevens te verliezen   |   Ronde zonder formule ...
Super opzoeken: Meerdere criteria VLookup    VLookup met meerdere waarden  |   VOpzoeken over meerdere bladen   |   Fuzzy opzoeken ....
Geavanceerde vervolgkeuzelijst: Maak snel een vervolgkeuzelijst   |  Afhankelijke vervolgkeuzelijst   |  Multi-select vervolgkeuzelijst ....
Kolom Beheerder: Voeg een specifiek aantal kolommen toe  |  Kolommen verplaatsen  |  Schakel de zichtbaarheidsstatus van verborgen kolommen in  |  Vergelijk bereiken en kolommen ...
Uitgelichte functies: Raster focus   |  Ontwerpweergave   |   Grote formulebalk    Werkmap- en bladbeheer   |  resource Library (Auto-tekst)   |  Datumkiezer   |  Combineer werkbladen   |  Cellen coderen/decoderen    Stuur e-mails per lijst   |  Super filter   |   Speciaal filter (filter vet/cursief/doorhalen...) ...
Top 15 gereedschapsets12 Tekst Tools (toe te voegen tekst, Tekens verwijderen, ...)   |   50+ tabel Types (Gantt Chart, ...)   |   40+ Praktisch Formules (Bereken leeftijd op basis van verjaardag, ...)   |   19 Invoeging Tools (QR-code invoegen, Afbeelding invoegen vanaf pad, ...)   |   12 Camper ombouw Tools (Getallen naar woorden, Currency Conversion, ...)   |   7 Samenvoegen en splitsen Tools (Geavanceerd Combineer rijen, Gespleten cellen, ...)   |   ... en meer

Geef uw Excel-vaardigheden een boost met Kutools voor Excel en ervaar efficiëntie als nooit tevoren. Kutools voor Excel biedt meer dan 300 geavanceerde functies om de productiviteit te verhogen en tijd te besparen.  Klik hier om de functie te krijgen die u het meest nodig heeft...

Omschrijving


Office-tabblad Brengt een interface met tabbladen naar Office en maakt uw werk veel gemakkelijker

  • Schakel bewerken en lezen met tabbladen in Word, Excel, PowerPoint in, Publisher, Access, Visio en Project.
  • Open en maak meerdere documenten in nieuwe tabbladen van hetzelfde venster in plaats van in nieuwe vensters.
  • Verhoogt uw productiviteit met 50% en vermindert honderden muisklikken voor u elke dag!
Comments (13)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
hello bro, is it possible to add an icon?
for example double-click the first checklist icon ,and if you double click the second cross icon appears ,and double click the last to go blank .
Rated 5 out of 5
This comment was minimized by the moderator on the site
Bonjour,

Une fois ces cases cochées, j'aimerais qu'une cellule x m'additionne les chiffres d'une certaine colonne, est ce possible ?

Merci à vous, bonne soirée
This comment was minimized by the moderator on the site
How do I make it so that it adds a time stamp on the adjacent cell after the double click?
This comment was minimized by the moderator on the site
Hi Sora,
The following VBA code can do you a favor. Please give it a try. Thank you.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Updated by Extendoffice 20221125
    Dim xRight As Range
    Dim KeyCells As Range
    Set KeyCells = Range("B1:B10")
    Set xRight = Target.Offset(0, 1)
    If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
        xRight.Value = Now()
    End If
Application.EnableEvents = True
End Sub
This comment was minimized by the moderator on the site
Eu gostaria de saber se é possível adicionar a marca com apenas um clique ao invés de dois.
This comment was minimized by the moderator on the site
Hi Ulisses Nonato,
If you want to add a check mark to a cell with only one mouse click, the following VBA code can do you a favor.
You need to click the right mouse button to activate the code.
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    'Updated by Extendoffice 20220714
    If Not Intersect(Target, Range("B1:B10")) Is Nothing Then
        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
This comment was minimized by the moderator on the site
How do i repeat this for multiple columns? 
For example i need it in the following:
E, F, I, J, M, N ,Q, R, U, V, Y, Z, AC, AD, AG, AH, AK, AL, AO, AP, AS, AT, AW, AX
This comment was minimized by the moderator on the site
Hi crystal
is there a way to have checkmarks in A1:A10 along with B3:B10?
This comment was minimized by the moderator on the site
Hi there! What would I add to the above code to get the cell to change color when the check box is added?
This comment was minimized by the moderator on the site
Is there a way to loop this code so that it is on a lot of worksheets in one workbook?
This comment was minimized by the moderator on the site
Hi leoflute,After pressing the Alt + F11 keys to open the Microsoft Visual Basic for Applications window, please double click ThisWorkbook to open the ThisWorkbook(Code) window, and then copy the below code into the code window. Don't forget to change the sheet names and the cell range in the code.<div data-tag="code">Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
'Updated by Extendoffice 20201012
Dim xStrRg, xStrWs, xStrWsName As String
Dim xEEBol, xWSNBol, xBol As Boolean
Dim xArrWs
Dim xArrRg
Dim xI, xJ As Integer
Dim xWs As Worksheet
Dim xRg As Range

xStrWs = "Sheet5,Sheet1,Sheet2" 'The specific worksheet names
xStrRg = "B3:B10" 'The range of cells you will insert check marks
xArrWs = Split(xStrWs, ",")
xArrRg = Split(xStrRg, ",")

xEEBol = Application.EnableEvents
Application.EnableEvents = False
On Error Resume Next
xStrWsName = Sh.Name
xBol = False
xWSNBol = False
For xI = 0 To UBound(xArrWs)
If xStrWsName = xArrWs(xI) Then
xWSNBol = True
Exit For
End If
Next xI

If xWSNBol Then
Set xWs = Application.Worksheets.Item(xArrWs(xI))
For xJ = 0 To UBound(xArrRg)
Set xRg = Sh.Range(xArrRg(xJ))
If Not Intersect(Target, xRg) Is Nothing Then
xBol = True
Exit For
End If
Next xJ
End If

If xBol Then
If ActiveCell.Value = ChrW(&H2713) Then
ActiveCell.ClearContents
Else
ActiveCell.Value = ChrW(&H2713)
End If
Cancel = True
End If
Application.EnableEvents = xEEBol
End Sub

This comment was minimized by the moderator on the site
como eu faço pra inserir a marca de seleção na célula, porém sem deletar o número que estiver digitado nela ou seja, a marca sairia na frente do número quando eu der duplo clique... e quando eu quizer apagar a marca, eu dou duplo clique novamente e a célula voltaria ao normar (continuaria apenas o número).
This comment was minimized by the moderator on the site
Ola Luiz, tente essa alteracao. Ira funcionar nas celulas A2:A10 e D2:D5, altere conforme sua necessidade.

Tadao


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Union(Range("A2:A10"), Range("D2:D5"))) Is Nothing Then
Application.EnableEvents = False
If Left(ActiveCell.Value, 1) = ChrW(&H2713) Then
ActiveCell.Value = Right(ActiveCell, Len(ActiveCell) - 1)
ActiveCell.HorizontalAlignment = xlRight
Else
ActiveCell.Value = ChrW(&H2713) & ActiveCell.Value
End If
Cancel = True
End If
Application.EnableEvents = True
End Sub
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations