You can remove both data and cell formatting from a selected cell or range or cells, or remove only the data, leaving the cell formatting intact. For more information about cell formatting, refer to Understanding How Cell Types Display Data. You can remove the data using any of the clear methods or by cutting the data using the Clipboard operation.
You can remove the data using any of these clear methods in the default data model:
- Clear, which clears both data and formulas
- ClearFormulas, which clears only formulas
- ClearData, which clears only data
- ClearCustomNames, which clears custom names, and ClearCustomFunctions, which clears custom functions
- ClearRange, which clears data, formulas, notes, and formatting from a range of cells
If you use ClearRange and set the dataOnly parameter to true, the method clears the formulas, the cell notes, and the text in the cells in that range; in other words, it clears all the information that is in the data model for those cells.
You can remove the contents of a range of cells using this method in the range interface:
- IRangeSupport.Clear