2013年7月19日金曜日

switch all comments show/hide by dblClick a cell

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Address = "$A$1" Then
        If Target.Value = "on" Then
            Target.Value = ""
            Application.DisplayCommentIndicator = xlCommentIndicatorOnly
        Else
            Application.DisplayCommentIndicator = xlCommentAndIndicator
            Target.Value = "on"
        End If
        Cancel = True
    End If
End Sub