...批注没法一个个设置。我想让所有批注在随着单元格走

发布网友

我来回答

1个回答

热心网友

Private Sub CommandButton1_Click()
Dim TTT$
TTT = InputBox("● 本程序将设置本工作表批注:" & Chr(13) & Chr(13) _
& " 1、“属性”为:大小固定,位置随单元格而变" & Chr(13) _
& " 2、“对齐”为:自动调整大小" & Chr(13) & Chr(13) _
& "● 选定单一单元格时,处理整个工作表内批注;" & Chr(13) _
& " 选定多个单元格时,处理选定区域内批注。" & Chr(13) _
& Chr(13) & Chr(13) & "是否继续执行?", "提示", "是")

If TTT <> "是" Then Exit Sub
Application.ScreenUpdating = False
On Error GoTo 10

Dim TempRngA As Range
Dim tempRngB As Range
Set TempRngA = Selection
Set tempRngB = ActiveCell
Dim Rng As Range

Application.DisplayCommentIndicator = xlCommentAndIndicator '显示批注和标识符

If Selection.Cells.Count = 1 Then Cells.Select
Selection.SpecialCells(xlCellTypeComments).Select

For Each Rng In Selection

Rng.Activate
ActiveCell.Comment.Shape.Select True
Selection.Placement = xlMove '大小固定,位置随单元格而变
Selection.AutoSize = True '自动调整大小

Next Rng

10 TempRngA.Select
tempRngB.Activate
Set TempRngA = Nothing
Set tempRngB = Nothing

'Application.DisplayCommentIndicator = xlCommentIndicatorOnly '仅显示标识符
Application.ScreenUpdating = True

End Sub

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com