@excel注释_在窗口中心显示Excel注释

@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注释

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值