[ActiveWorkbook.[ActiveSheet.]]Names
Option Explicit
Public Sub ShowComments()
Dim n As Name, r As Range
If ActiveWorkbook Is Nothing Then
MsgBox "Open the document first!", vbExclamation
Else
For Each n In ActiveWorkbook.Names
Set r = Nothing
On Error Resume Next
Set r = n.RefersToRange
On Error GoTo 0
If Not r Is Nothing Then
If Not r.Cells(1, r.Columns.Count).Comment Is Nothing Then r.Cells(1, r.Columns.Count).Comment.Delete
On Error GoTo 1
With r.Cells(1, r.Columns.Count).AddComment(n.Name)
.Shape.TextFrame.AutoSize = True
.Visible = True
End With
End If
1 Next
End If
End Sub
Public Sub HideComments()
Dim n As Name
If ActiveWorkbook Is Nothing Then
MsgBox "Open the document first!", vbExclamation
Else
For Each n In ActiveWorkbook.Names
On Error Resume Next
n.RefersToRange(1, n.RefersToRange.Columns.Count).Comment.Delete
Next
End If
End Sub
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 3