public void ClearCellFormat(bool clearAll) { if (clearAll) { Excel.Worksheet ws = app.ActiveWorkbook.ActiveSheet; ws.UsedRange.ClearFormats(); ws.UsedRange.ClearNotes(); } else { Excel.Range range = app.Selection as Excel.Range; if (range != null) { range.ClearFormats(); range.ClearNotes(); } } }