メインコンテンツへスキップ

Excelでダブルクリックしてセルにチェックマークを追加するにはどうすればよいですか?

通常、セルにチェックマークを挿入するには、[記号]ダイアログボックスに移動し、チェックマーク記号を見つけて手動で挿入する必要があります。 ただし、内部には多数の記号がリストされているため、[記号]ダイアログボックスでチェックマーク記号を見つけるのはそれほど簡単ではありません。 Excelのセルにチェックマークをすばやく追加するにはどうすればよいですか? この記事では、ダブルクリックするだけでセルにチェックマークを簡単に追加するVBAメソッドを紹介します。

ダブルクリックして、VBAコードのあるセルにチェックマークを追加します


ダブルクリックして、VBAコードのあるセルにチェックマークを追加します

次のVBAコードは、ダブルクリックしてセルにチェックマークを追加するのに役立ちます。 次のようにしてください。

1.セルにチェックマークを追加するために必要なワークシートを開き、右クリックして選択します コードを表示 右クリックメニューから。

2。 の中に アプリケーション向け Microsoft Visual Basic ウィンドウで、以下のVBAコードをコピーして Code 窓。

VBAコード:ダブルクリックしてセルにチェックマークを追加します

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:コードでは、B1:B10は、ダブルクリックでチェックマークを追加する範囲です。 必要に応じて変更してください。

3。 プレス 他の + Q を閉じるためのキー アプリケーション向け Microsoft Visual Basic ウィンドウを開き、ワークシートに戻ります。

ここで、範囲B1:B10のセルをダブルクリックすると、チェックマークが自動的に入力されます。 セルをもう一度ダブルクリックすると、挿入されたチェックマークが削除されます。

Excelの日常業務でチェックマークを頻繁に使用する必要がある場合は、ここで 自動テキスト の効用 Kutools for Excel。 この機能を使用すると、チェックマークを自動テキスト入力として保存し、以下のデモに示すように、Excelでワンクリックするだけで後で再送信できます。
ダウンロードして今すぐ試してみてください! (30 日間の無料トレイル)


関連記事:

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
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