(Solved) – Clear all cells which do not have a color

(solved)-–-clear-all-cells-which-do-not-have-a-color

I have a big table (100 columns * 1000 rows) and certain cells in this table are filled with different colors (red, yellow, blue, orange and other colors). I want to clear all selected cells that have no colors. I wrote a simple macro that will be good for a small table, but for a large table, the computational power drops and if several colored cells are selected in the same range, then the cells are not cleared. How can I reduce the cleaning time of the table and fix the error when the specified area has different colors?

Sub ClearData()
For Each cell in Selection
If cell.Interior.ColorIndex = xlNone Then
cell.ClearContents
End If
Next cell
MsgBox "Done!"
End Subs

Leave a Reply

Your email address will not be published. Required fields are marked *