Deleted comment with VBA still showing red indicator

S Oberlander

Board Regular
Joined
Nov 25, 2020
Messages
147
Office Version
  1. 365
Platform
  1. Windows
My code is simple, I know the names of my comment shape so I just did:
VBA Code:
        With ActiveSheet
        .Shapes("Comment 1").Delete
        .Shapes("Comment 2").Delete
        .Shapes("Comment 4").Delete
        End With
But the cells that contained the comments still have that little red triangle indicating a comment even though there is none.
How can I get rid of that triangle?
 
If you wanted to delete all comments in active sheet.
You could have used this:

VBA Code:
Sub Delete_All_Comments()
'Modified 12/3/2020  10:06:17 AM  EST
Application.ScreenUpdating = False
Dim c As Comment
For Each c In ActiveSheet.Comments
    c.Delete
Next

Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
You don't need the x variable, you can just do
VBA Code:
For Each cmt In Ws.Comments
    cmt.Delete
Next cmt
He knew the comment but do not know the address. The code is to find the address so that can delete specific comment. This is what I understood.
 
Upvote 0
I was just going by the code in post#9.
 
Upvote 0

Forum statistics

Threads
1,213,526
Messages
6,114,136
Members
448,551
Latest member
Sienna de Souza

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top