Cell background color change

mmcginn

New Member
Joined
Mar 14, 2011
Messages
5
Hi,

I had what i assumed to be an easy problem. However I am unable to find a soultion and would be greatful for your help.

I have a worksheet with cells coloured in two colors. One of those colors "RGB(216,216,216)" needs to be cleared when the sheet is consolidated to a new workbook leaving the other intact. This rules out a global clear of all colors.

Thanks in advance. Matt
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
You mean you have one cell one colour and another cell another colour?, why can't you check the range for the colorindex and then change it to xlNone?
 
Upvote 0
You mean you have one cell one colour and another cell another colour?, why can't you check the range for the colorindex and then change it to xlNone?

The colors are mixed accross the spreadsheet Some Grey, some blue.

Initially I used this but it just didn't work. Maybe I am missing something obvious!

Code:
Sub Clear_Grey()
 
     If Range("A1:M68").Interior.color = RGB(191, 191, 191) Then
        Range("A1:M68").Interior.color = RGB(11, 11, 11)
 
End If
End Sub
 
Upvote 0
this will remove light grey from your range, use 5 instead of 15 for dark blue
Code:
Sub remove_colour()
Dim MyCell As Range, Rng As Range
Set Rng = Range("A1:M68")
For Each MyCell In Rng
If MyCell.Interior.ColorIndex = 15 Then
MyCell.Interior.ColorIndex = xlNone
End If
Next MyCell
End Sub
 
Upvote 0
Simon,

This is great and does exactly what I need. owever, I need to run it on 120 sheets and it's very slow.

Is there any way to do the same thing but without looping through each cell?

Matt
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,486
Members
452,917
Latest member
MrsMSalt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top