@excel注释
When you add comments to an Excel worksheet, they pop up to the top right of the cell, when you point to a cell with comments.
当您将注释添加到Excel工作表时,当您指向带有注释的单元格时,它们会弹出到单元格的右上角。
That's fine most of the time, but if the cell is near the top or right of the window, you might not be able to read the comment.
在大多数情况下都可以,但是如果该单元格位于窗口顶部或右侧附近,则可能无法阅读注释。
Unfortunately, you can't control the comment's popup position, but with a bit of programming, you can show the comment in the centre of the screen, when you click on the cell.
不幸的是,您无法控制注释的弹出位置,但是通过一些编程,您可以在单击单元格时在屏幕中央显示注释。
中心Excel注释代码 (Centre Excel Comments Code)
Paste the following code onto a worksheet module. Then, when you click on a cell that contains a comment, that comment is shown in the centre of the active window's visible range.
将以下代码粘贴到工作表模块上 。 然后,当您单击包含注释的单元格时,该注释将显示在活动窗口的可见范围的中心。
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'www.contextures.com/xlcomments03.html
Dim rng As Range
Dim cTop As Long
Dim cWidth As Long
Dim cmt As Comment
Dim sh As Shape
Application.DisplayCommentIndicator _
= xlCommentIndicatorOnly
Set rng = ActiveWindow.VisibleRange
cTop = rng.Top + rng.Height / 2
cWidth = rng.Left + rng.Width / 2
If ActiveCell.Comment Is Nothing Then
'do nothing
Else
Set cmt = ActiveCell.Comment
Set sh = cmt.Shape
sh.Top = cTop - sh.Height / 2
sh.Left = cWidth - sh.Width / 2
cmt.Visible = True
End If
End Sub
更多Excel注释宏 (More Excel Comment Macros)
For more Excel comment macros, please visit the Excel Comment VBA page on the Contextures website. ______________
有关更多Excel注释宏,请访问Contextures网站上的Excel Comment VBA页面。 ______________
翻译自: https://contexturesblog.com/archives/2011/09/21/show-excel-comments-in-centre-of-window/
@excel注释