Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old December 14th 05, 11:41 PM posted to microsoft.public.excel.worksheet.functions
Danny
 
Posts: n/a
Default Macro - Delete Comments - What if there's none?

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.


  #2   Report Post  
Old December 14th 05, 11:56 PM posted to microsoft.public.excel.worksheet.functions
Chip Pearson
 
Posts: n/a
Default Macro - Delete Comments - What if there's none?

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


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

"Danny" wrote in message
news
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.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Delete Macro denise Excel Discussion (Misc queries) 2 September 26th 05 09:56 PM
macro to copy and edit then delete a worksheet lschuh Excel Discussion (Misc queries) 13 July 27th 05 09:02 PM
Error when trying to delete a macro... Currie Excel Discussion (Misc queries) 5 July 6th 05 07:31 PM
Can't find macro in an Excel file to delete it Ron Excel Discussion (Misc queries) 3 July 1st 05 01:07 PM
Macro data selection line delete Frantic Excel-er Excel Discussion (Misc queries) 0 May 31st 05 11:46 PM


All times are GMT +1. The time now is 02:00 AM.

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2004-2019 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"

 

Copyright © 2017