Ankethaton2
New Member
- Joined
- Feb 23, 2009
- Messages
- 6
I am looking for a vba code that would delete the content of a cell based on its background color.
My workbook has several worksheets in which cells have a light yellow background if the user can input in them.
Now I created a button which would reset the entire model, ie delete the content that the user placed in the yellow cells.
My code is as follows, but does not seem to work:
Sub reset()
Dim c As Range
For Each c In ThisWorkbook
If c.Interior.ColorIndex = 36 Then c.ClearContents
Next c
End Sub
Thanks for any help on this.
My workbook has several worksheets in which cells have a light yellow background if the user can input in them.
Now I created a button which would reset the entire model, ie delete the content that the user placed in the yellow cells.
My code is as follows, but does not seem to work:
Sub reset()
Dim c As Range
For Each c In ThisWorkbook
If c.Interior.ColorIndex = 36 Then c.ClearContents
Next c
End Sub
Thanks for any help on this.