Deleted comment with VBA still showing red indicator

S Oberlander

New Member
Joined
Nov 25, 2020
Messages
10
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?
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
17,251
Office Version
  1. 2013
Platform
  1. Windows
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
 
Solution

Some videos you may like

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
52,833
Office Version
  1. 365
Platform
  1. Windows
My pleasure.
 

Zot

Well-known Member
Joined
Nov 26, 2020
Messages
569
Office Version
  1. 2016
Platform
  1. Windows
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.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
52,833
Office Version
  1. 365
Platform
  1. Windows
I was just going by the code in post#9.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,355
Messages
5,595,680
Members
414,008
Latest member
SNesbyCarr

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
Top