View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default How to replace the background color of all cells from light greento light blue?

try this macro - change the range to suit your range. NOTE: this
will not work if the cells that are green are green because of
conditional formatting!!!! this will only work if they have been
manually colored. if you have conditional formatting involved, you
will need something different.

'--------------------------------------------------------------------------
Sub change_color()

Dim myWS As Worksheet
Dim c As Range
Dim myRange As Range

Set myWS = ActiveSheet
Set myRange = ws.Range("a1:g500") '<--CHANGE RANGE

For Each c In myRange
If c.Interior.ColorIndex = 35 Then 'green
c.Interior.ColorIndex = 34 'blue
End If
Next c

End Sub
'------------------------------------------------------------------------

hope that helps!
:)
susan



On Nov 14, 1:54*pm, (Claudia d'Amato) wrote:
Assume I have a worksheet where some (but not all !!) cells have a background color of light green.

How can I change at once (!) the background color of all those cells to light blue?

All other cells should remain unchanged.

Claudia