返回一个
Comment 对象,该对象代表前一条批注。
语法
表达式.Previous
表达式 一个返回 Comment 对象的表达式。
返回值
Comment
说明
本方法仅对单张工作表有效。对工作表中第一条批注使用本方法可返回 Null(不是前一张工作表的最后一条批注)。
示例
本示例隐藏前一条批注。
注释 |
请在不带现有批注的新工作簿中进行测试。若要清除工作簿中的所有批注,请在即时窗格中使用
Selection.SpecialCells(xlCellTypeComments).Delete 。 |
示例代码 |
//Sets up the comments
for(let xNum = 1;xNum <= 10;xNum++) {
Range("A" + xNum).AddComment()
Range("A" + xNum).Comment.Text("Comment " + xNum)
}
MsgBox("Comments created... A1:A10")
//Deletes every second comment in the A1:A10 range
for(let yNum = 10;yNum >= 1;yNum = yNum - 2) {
Range("A" + yNum).Comment.Previous().Shape.Select(true)
Selection.Delete()
}
MsgBox("Deleted every second comment")
|