Delete zeros in light yellow cells

  • Thread starter Thread starter Claude
  • Start date Start date
C

Claude

I am working with a state mandated Excel template and need to write a macro
that will delete the contents of cells that first are light yellow
(.ColorIndex = 36) and second are not textual. I can write the necessary
macro in Lotus 123 but Excel is a whole different world.

The Excel template has merged cells, formulation in different colored cells
(which must remain unchanged) and 3,000 rows with columns to AJ in the
largest worksheet. Other worksheets in the file have fewer lines and fewer
columns. Each row has different merged cells. I need a repeating macro to
evaluate each cell individually and to delete only those light yellow cells
(or light yellow merged cells) that are not text and which evaluate to zero.

All help is greatly appreciated.

Thanks, Claude
 
One way:

Public Sub ClearLightYellowNumbers()
Dim cell As Range
For Each cell In ActiveSheet.UsedRange
With cell
If IsNumeric(.Value) Then _
If .Value = 0 Then _
If .Interior.ColorIndex = 36 Then _
.MergeArea.ClearContents
End With
Next cell
End Sub
 
Back
Top