Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / December 2005

Tip: Looking for answers? Try searching our database.

Macro - Delete Comments - What if there's none?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Danny - 14 Dec 2005 22:41 GMT
Hi,

I inserted the Macro below into a series of macros.  If there is(are) NO
comment(s) in the worksheet,  my macros will not run properly. Please edit my
macro so if there is(are) NO comment(s), the rest of the macros will still
run.

Sub DeleteComments()
   Application.Goto Reference:="My_Range"
   Selection.SpecialCells(xlCellTypeComments).Select
   Selection.EntireRow.Delete
End Sub

Thank You.
Chip Pearson - 14 Dec 2005 22:56 GMT
Danny,

Try

Sub DeleteComments()
   Application.Goto Reference:="My_Range"
   On Error Resume Next
   Selection.SpecialCells(xlCellTypeComments).Select
   If Err.Number = 0 Then
       Selection.EntireRow.Delete
   End If
End Sub

Signature

Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

> Hi,
>
[quoted text clipped - 13 lines]
>
> Thank You.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.