Comment.Previous method (Excel)
Returns a Comment object that represents the previous comment.
Syntax
expression.Previous
expression An expression that returns a Comment object.
Return value
Comment
Remarks
This method works only on one sheet. Using this method on the first comment on a sheet returns Null (not the last comment on the previous sheet).
Example
This example deletes every second comment, navigating with the Previous method.
Note
Test this example in a new workbook with no existing comments. To clear all the comments from a workbook, use Selection.SpecialCells(xlCellTypeComments).delete
in the Immediate pane.
'Sets up the comments
For xNum = 1 To 10
Range("A" & xNum).AddComment
Range("A" & xNum).Comment.Text Text:="Comment " & xNum
Next
MsgBox "Comments created... A1:A10"
'Deletes every second comment in the A1:A10 range
For yNum = 10 To 1 Step -2
Range("A" & yNum).Comment.Previous.Shape.Select True
Selection.Delete
Next
MsgBox "Deleted every second comment"
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기