当前位置:首页教育技巧excel技巧excel数据库

excel表格在excel用VBA更改批注的作者

2024-07-23 20:31:13


在Excel中,当光标移动到包含批注的单元格中时,通常会在状态栏和批注中显示批注者的名称。如果需要将批注者改为其他人,可以用下面的VBA代码。以后再插入新的批注,也将使用新输入的名称。使用前先将代码中的“新作者”和“原作者”按照需要进行替换。

Sub ChangeCommentName()
Dim ws As Worksheet
Dim cmt As Comment
Dim strOld As String
Dim strNew As String
Dim strComment As String
strNew = "新作者"
strOld = "原作者"
Application.UserName = strNew
For Each ws In ActiveWorkbook.Worksheets
For Each cmt In wsments
strComment = Replace(cmt.Text, strOld, strNew)
cmt.Delete
cmt.Parent.AddComment Text:=strComment
Next cmt
Next ws
End Sub

相关信息


电脑版

【免责声明】本站信息来自网友投稿及网络整理,内容仅供参考,如果有错误请反馈给我们及时更正,对文中内容的真实性和完整性本站不提供任何保证,不承但任何责任。
版权所有:学窍知识网 Copyright © 2011-2024 www.at317.com All Rights Reserved .