ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Delete shaded cells (https://www.excelbanter.com/excel-discussion-misc-queries/11155-delete-shaded-cells.html)

Patience

Delete shaded cells
 
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,

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

-----Original Message-----
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,
.



All times are GMT +1. The time now is 10:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com