且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

简单的VBA显示/隐藏Excel注释问题

更新时间:2023-02-08 14:40:18

尝试这样:

   Sub showcomments()
   Comments = 1
   For Each MyComments In ActiveSheet.Comments
       If MyComments.Visible = True Then
           Comments = 0
       End If
   Next
   If Comments = 1 Then
       Application.DisplayCommentIndicator = xlCommentAndIndicator
   Else
       Application.DisplayCommentIndicator = xlCommentIndicatorOnly
   End If
End Sub