Delete shaded cells

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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,
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top