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

excel表格自动标注怎么设置

2024-07-08 10:43:14


1.excel表格如何自动加注批注?

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = 1 And Target.Count = 1 Then

Target.AddComment

Target.Comment.Visible = True

Target.Comment.Text Text:=Target.Value & ":" & Chr(10) & ""

End If

End Sub

2.Excel 2010怎么自动添加批注?

在工作表标签上击右键,查看代码,在VBE窗口中点“插入”,模块,

在模块代码窗口中粘贴以下代码,然后按ALT+F8运行之,即可

Sub 添加批注()

For i = 1 To 2 '注:列遍历

For j = 4 To Cells(65536, i).End(3).Row '注:行遍历

If Cells(j, i) "" Then '检测非空

Dim a

a = ""

For K = 2 To [e65536].End(3).Row '遍历E列区域

If Cells(K, 5) = Cells(j, i) Then '比对数据

a = a & CStr(Cells(K, 6)) '获取对应F列的值存入变量a。

On Error Resume Next '容错

Cells(j, i).ClearComments '若有批注,先行删除

Cells(j, i).AddComment '添加批注

Cells(j, i).Comment.Visible = False '批注隐藏

Cells(j, i).Comment.Text Text:=a '批注内容

End If

Next

End If

Next

Next

End Sub

相关信息


电脑版

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