If Not Range("A1").Comment Is Nothing Then Range("A1").Comment.Delete
Range("A1").AddComment Text:="你好,这是用VBA添加的批注!"
With Range("A1").Comment
.Shape.TextFrame.Characters.Font.Size = 13 '设置字号13
.Shape.TextFrame.Characters.Font.Name = "黑体" '设置字体黑体
.Visible = True '显示批注
End With
End Sub
Sheets(1).Range("A1").AddComment '给A1添加批注With Sheets(1).Range("A1").Comment
.Text "EvilFarmer:222" &Chr(10) &"" '批准内容
.Visible = True'可见
.Shape.Fill.UserPicture _'批注图片设置
"C:\Users\EvilFarmer\Desktop\adad.jpg"
.Shape.ScaleWidth 1.55, msoFalse, msoScaleFromTopLeft '宽度设置
.Shape.ScaleHeight 2.22, msoFalse, msoScaleFromTopLeft '高度设置
.Shape.IncrementLeft 116.25'位置设置,靠左的距离
.Shape.IncrementTop 102.75 '离顶部的距离
End With
点工作表 标签 查看代码,如下代码复制进去, 修改 单元格内容 触发
Private Sub Worksheet_Change(ByVal Target As Range)If Target.Column = 12 And Target.Row >= 7 And Target.Row <= 44 And Target.Count = 1 Then
If Len(Target) > 40 Then
Target.AddComment
Target.Comment.Visible = True
Target.Comment.Text Text:="Yuan, Chen:" & Chr(10) & "Max 40 Characters"
End If
End If
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)