June 7, 2019

Create Interactive Checklist

How to create an interactive checklist with VBA quickly and easily. We can use check-boxes with conditional formatting. This is a tedious process especially if you have multiple items in your check-list. With VBA or Visual Basic for Applications we can automate the process and create an interactive check list quickly and easily. Watch the video below:

Watch this video on YouTube.

Here’s the complete VBA code:

Sub CreateCheckList()
Dim chk As CheckBox
Dim counter As Long
counter = 0
For Each chk In ActiveSheet.CheckBoxes

chk.LinkedCell = chk.TopLeftCell.Offset(0, -1).Address
chk.TopLeftCell.Offset(0, -1).Font.Color = vbWhite

If chk.TopLeftCell.Offset(0, -1) = True Then
    counter = counter + 1
    chk.TopLeftCell.Offset(0, 1).Font.Color = vbWhite
    chk.TopLeftCell.Offset(0, 1).Interior.Color = vbBlue
    ElseIf chk.TopLeftCell.Offset(0, -1) = False Then
    chk.TopLeftCell.Offset(0, 1).ClearFormats

End If

Next

If counter < 10 Then
MsgBox “You have complted ” & counter & ” out of 10 items!”
ElseIf counter = 10 Then
MsgBox “All items ordered!”
End If

End Sub