excel 在注解中设置字体

b5lpy0ml  于 7个月前  发布在  其他
关注(0)|答案(1)|浏览(66)

我在单元格注解中添加了一些行,所以我需要字体“CockyNew”。但我还需要一些更具体的设置,如字体和大小。

Sub SetCommants()
With Cells(4, 8)
    If Not .Comment Is Nothing Then .Comment.Delete
    .AddComment
    .Comment.Visible = False
    .Comment.Text Cells(1, 3) & Chr(10) & Cells(1, 4) & Chr(10) & Cells(1, 5) & Chr(10) & Cells(1, 6)
    .Comment.Shape.TextFrame.AutoSize = True
End With 
End Sub

字符串
我必须在代码中插入哪些行来设置字体?

lawou6xi

lawou6xi1#

Sub SetCommants()

    Dim ar
    ar = Application.Transpose(Application.Transpose(Range("C1:F1")))
    
    With Cells(4, 8)
        If Not .Comment Is Nothing Then .Comment.Delete
        .AddComment
        .Comment.Visible = False
        .Comment.Text Join(ar, vbLf)
        With .Comment.Shape.TextFrame
            With .Characters(1).Font
                .Color = vbRed
                .Name = "Courier New"
                .Size = 16
                .Bold = True
                .Italic = True
            End With
            .AutoSize = True
        End With
    End With
    
End Sub

字符串

相关问题