0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Excel VBA チェックボックスに全選択/全解除機能を付ける

Posted at

チェックボックスに全選択/全解除機能を付けるコード

自分メモ
チェックボックスの上で右クリック → マクロの登録 で以下のプロシージャを登録

Sub チェック11_Click()

Dim i As Long
Dim ws As Worksheet
Set ws = Sheets("Sheet4")

    If ws.Range("E1") = True Then

        For i = 2 To 11
            ws.Cells(i, 5) = True
        Next i

    Else

        For i = 2 To 11
            ws.Cells(i, 5) = False
        Next i

    End If

End Sub

実行結果
D1セルのチェックボックスをクリックすると、すべてのチェックボックスにチェックが入る

全選択.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?