Delete shaded cells

P

Patience

Hi. I have a rather large spreadsheet in Excel XP, and there are cells
scattered throughout that are shaded pale yellow. I need to delete those from
the sheet before performing some calculations.
Can you help me with a code that will do just that, or do I need to manually
go through every column and remove the shaded cells by hand?
Thanks,
 
J

Jason Morin

Try this macro:

Sub ClearYellow()
Set rng = ActiveSheet.UsedRange
Application.ScreenUpdating = False
For Each cell In rng
With cell
If .Interior.ColorIndex = 36 Then
.ClearContents
End If
End With
Next
Application.ScreenUpdating = True
End Sub

Put it in a standard module and run with Tools > Macro >
Macros, see:

http://www.mcgimpsey.com/excel/modules.html

HTH
Jason
Atlanta, GA
 
Top