Gruppe
Allgemein
Problem
Wie kann ich auf Buttondruck ein Kommentarfeld für die aktive Zelle in einer bestimmt Schriftgröße erstellen?
ClassModule: Tabelle3
Private Sub CommandButton1_Click()
Dim cmt As Comment
ActiveCell.Select
Application.DisplayCommentIndicator = xlCommentAndIndicator
Set cmt = ActiveCell.AddComment
cmt.Shape.Select
With cmt.Shape.TextFrame.Characters.Font
.Name = "Arial"
.Size = 14
End With
End Sub
Private Sub CommandButton2_Click()
Application.DisplayCommentIndicator = xlCommentIndicatorOnly
End Sub
StandardModule: Modul1
Sub SetComment()
Dim cmt As Comment
Application.DisplayCommentIndicator = xlCommentIndicatorOnly
If Not ActiveCell.Comment Is Nothing Then
ActiveCell.Comment.Delete
End If
Set cmt = ActiveCell.AddComment("Mein Kommentar")
With cmt.Shape.TextFrame
With .Characters.Font
.Name = "Arial"
.Size = 14
.Bold = False
End With
.AutoSize = True
End With
End Sub