'Comment 对象
'代表单元格批注
'批注添加
Sub 批注添加()
With [a1]
If .Comment Is Nothing Then
.AddComment.Text "123"
.Comment.Visible = True
End If
End With
End Sub
Sub 删除批注()
For Each Rng In Selection
If Not Rng.Comment Is Nothing Then
Rng.ClearComments
End If
Next
End Sub
Sub 批量添加批注()
For Each Rng In Range("a2:a20")
Rng.ClearComments
If Rng >= 90 Then Rng.AddComment.Text "优秀"
Next
End Sub
案例
'修改批注
Sub 修改批注()
Range("a2").AddComment '添加批注
[a2].Comment.Shape.Height = 50 '设置批注高度
[a2].Comment.Shape.Width = 40 '设置批注宽度
[a2].Comment.Shape.Fill.UserPicture ThisWorkbook.Path & "\7pic\阿汤.png"
End Sub
Sub 批量将批注增加背景()
For Ea