Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 ... 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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can't Delete Macro | Excel Discussion (Misc queries) | |||
macro to copy and edit then delete a worksheet | Excel Discussion (Misc queries) | |||
Error when trying to delete a macro... | Excel Discussion (Misc queries) | |||
Can't find macro in an Excel file to delete it | Excel Discussion (Misc queries) | |||
Macro data selection line delete | Excel Discussion (Misc queries) |