Sub 批量插入統(tǒng)一批注()
Dim r As Range, msg As String
msg = InputBox("請(qǐng)輸入欲批量插入的批注", "提示", "隨便輸點(diǎn)什么吧")
If Selection.Cells.Count > 0 Then
Set r = ActiveCell
For Each r In Selection
r.AddComment
r.Comment.Visible = False
r.Comment.Text Text:=msg
Next
End If
End Sub
-----------------------------------------------------------------
Sub 檢測(cè)單元格中是否有批注信息()
On Error Resume Next
If Selection.SpecialCells(xlCellTypeComments) Is Nothing Then _
MsgBox "選擇區(qū)域沒有批注", vbInformation
End Sub
單個(gè)單元使用格上面代碼無(wú)效,使用下面代碼
If ActiveCell.Comment Is Nothing Then
---------------------------------------------------------------------
可按如下方法格給單元格添加批注:
Dim 批注文本 As String
批注文本="批注示例" '準(zhǔn)備批注文本
ActiveCell.AddComment '添加批注
ActiveCell.Comment.Text Text:=臨時(shí) '寫入批注文本
ActiveCell.Comment.Visible=False '隱藏批注