Excel macro to modify table comments

Revision as of 16:33, 20 November 2024 by Mwroot (talk | contribs) (Created page with "同事用 WPS 做的表格批注,用 MS Office Excel 打开,批注框糊成一小块,看不全,用以下宏可解决。 <syntaxhighlight lang="VBScript" line> Sub ResizeAllComments() Dim ws As Worksheet Dim cmt As Comment For Each ws In ThisWorkbook.Worksheets For Each cmt In ws.Comments With cmt.Shape .Width = 200 ' 设置批注框宽度,可根据需要调整 .Height = 50 ' 设置批注框...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

同事用 WPS 做的表格批注,用 MS Office Excel 打开,批注框糊成一小块,看不全,用以下宏可解决。

Sub ResizeAllComments()
    Dim ws As Worksheet
    Dim cmt As Comment
    
    For Each ws In ThisWorkbook.Worksheets
        For Each cmt In ws.Comments
            With cmt.Shape
                .Width = 200 ' 设置批注框宽度,可根据需要调整
                .Height = 50 ' 设置批注框高度,可根据需要调整
            End With
        Next cmt
    Next ws
End Sub

代码来自通义千问,prompt:

用宏批量调整批注框的大小