I'm having problms getting a loop working. I'm sure i'm mising something basic, but i can't see it.
The loop should take each cell in the range "admin", divide the date serial number within each cell (although formatted to 1/10/2008 is the first one, each susequent one is a day later) and return the remainder using "mod" to assign a colour to the cell 2 cells below.
If anyone can spare a few minutes to show me where my errors are, that would be great.

For Each cell In admin
colour.Value = cell.Value Mod 8
If colour = 3 Or 4 Then
cell.Offset(2, 0).Interior.ColorIndex = 3 'red
If colour = 5 Or 6 Then
cell.Offset(2, 0).Interior.ColorIndex = 10 'green
If colour = 7 Or 0 Then
cell.Offset(2, 0).Interior.ColorIndex = 5 'blue
If colour = 1 Or 2 Then
cell.Offset(2, 0).Interior.ColorIndex = 2 'white
End If
End If
End If
End If
Next cell

I'm trying to get a cell to update its' background colour based on the value of another cell. Although the value of the cell changes, the macro to change the background colour to change does not seem to get invoked.

Am just getting confused here....the idea is to have colour coding as below:

> 72 hrs = cell is green
between 0 and 24 hrs = cell is red
between 24 and 72 = yellow
0 or less than zero = cell is light blue
if no value or blank in cell = cell is white or no colour (but when value is i/p colour changes).....

since the values are calculated as difference in time (whatever was open time - current time to give current remaining life)..... could you please help with the code i posted ....seems am mixed up:

I also want to add in a condition that checks if the cell in the above range equals "Not Started" and the date (which is in the next column) is greater than or equal to today and then changes colour (to orange instead of green).. can anyone help?

I have created a basic loop to change the background colour of cells depending on the value in the cell and this works fine. However I want the worksheet to be able to update the background colour "on the fly" or as the number is selected from a list or changed in each specific in the range rather than having to run the macro after the changes have been made. I have included the code I am using below so you can understand what I am doing and hopefully what I want to do - any help much appreciated.

Using defined RGB colors using the statement 'activecell.interior.color = rgb(n,n,n)' does not always colour the cell. I have been trying to specifically colour cells within a project without consistent success.

From the immediate window, I tested and received the following results

rgb(0,0,255) (blue) works fine but Excel seems to change rgb(214,209,255) (light blue) to rgb(192,192,255)....a few shades darker which is not what I want.

I do not want to use the pallete as I have experienced issues when copying data from other workbooks (which presumably have different palletes) which consequently changes colours in the receiving sheet.

I am seeking to consistently colour cells with my custom selections many of which are lighter than than those in the pallete. Is there a limitation on rgb colours Excel will recognise?

I'm using a code that looks for colour 48 and replaces it with colour 15 and that works fine, but I would like to check for all colours except 'No colour', 'Colour 6' and 'Colour 8" and change them to 'Colour 15'. I don't know how to add the exclsion of None, 6 & 8 to my code.

Any help greatly appreciated, here's my code.

Code:

Sub Change_Grey()
Dim r As Range
For Each ws In Sheets
ws.Activate
For Each r In ActiveSheet.UsedRange
If r.Interior.ColorIndex = xlNone Then
Else: r.Interior.ColorIndex = 15
End If
Next r
Next ws
End Sub

I have the following code that changes the interior of a cell to green:

Selection.Interior.Color = 5287936
Does anyone know whether it is possible to have the code so that it selects all of the current worksheet and does the same and not just the cell the cursor is in when this is run?

I have a list of colours in a column that look like the following examples

LIGHT BLUE/GREY
BLUE/GREY
CHERRY RED/BLACK
SILVER
LIGHT GREY

They represent vehicle exterior colours and after the "/" this is the
interior colour. As you can see some have the interior after the slash and
some don't have the interior colour but have two words for the exterior. I
need to extract the exterior colour only as the following.

LIGHT BLUE
BLUE
CHERRY RED
SILVER
LIGHT GREY

I have tried the "find" and the "substitute" formula's but can't manage to
get it right.

I have found a macro that allows me to assign a colour to a specific brand. Does anyone know how I can alter this to apply the same formatting across a number of charts and not just the active chart...

I have a little macro that looks at a specific cell, and then copies the colour of that cell to the CONDITIONAL format colour for the cell. That is, if the initial cell in the row is Red, the macro will then choose red as the colour that will format the row following if the conditional format condition is met. If the next row cell is blue, the conditional format will be changed to blue.

How do i modify the following macro to start at the first coloured cell and run until it gets to the last coloured cell. In this piece, the ActiveCell is the same cell as ColouredCell which is a public variable named in an earlier routine. The earlier routine assigns a random colour to the ColouredCell.

The problem is this, some cells are already coloured, not all the same colours. When I select them they change to pale green as I want but then get changed to NONE when I select another cell. I know why but not how to stop it. Is there a way to have them return to their original colour? If they were all same colour I would know how.

Also, when I protect the sheet, the macro has no effect, can this be changed so it does work on protected sheet.

I have got some code to change colour of a column of cells H8:H301 depending upon dates in that range having certain criteria in relationship to cell H6.

But what i am trying to do is get all cells in Range A8:J301 also to change colour but still using Column H as to what i am checking against, please see code below and if any one can help me add what is needed i would appreciate this greatly

I am trying to set up a macro which searches for a particular text string and colours the cell in when this text string is found.

At the moment, I have got the macro to search for the cell and currently it colours the cell in Green.

I now want to develop the macro so when I fill in Cell B2 in a colour I want by using the fill function in Excel, the macro when run, determines what colour this is and fills all cells that contain the predefined text string in, with this colour.

I am trying to build a function to format the colour of one cell to the same as another cell, but its driving me mad as its been a while since ive had to program anything. The code I have tried is included below, however i know that it's way off the mark!

Dear All,
i have a little problem/puzzle im hoping somebody could solve for me
On Sheet1 In Column A starting in Row1 going downwards i have cells of different colours but this could be as little as 6 and as many as 30 they Only appear once and each colour has a Unique 3 Letter code in it
On Sheet2 In Column A starting in Row1 there is a 3 digit number for each colour ......... 2 or Colours could have the same 3 digit number but 99% of the time the number will be unique to the colour

On Sheet2 In column A starting in Row 1 going downwards i have up to 180 rows all mixed up of the colours in Row A with out the unique 3 letter code.
Could anybody write some small code to try and sort out to start on sheet 2 Cell A1 find out what colour the cell is and "look" for it find the colour and copy the colour and 3 Letter code to Sheet 2 Column A and also copy the 3 digit number to column B

Can anyone tell m firstly where I can find the colour pallette codes for commands like, as my suck it see method of guessing the right colour is pretty time cosuming.
selection.Interior.ColorIndex = 34

and secondly, can rgb be used to fill cells colour i.e. something like
range.colour or background whatever the command is. rgb(255,255,255)

I would like some help in writing a macro to allow a few things to happen within a excel worksheet.

I have a spreadsheet detailing when something has been completed, and into a cell you will put a date and change cell colour, if green, then I would like the macro to input a date +84 days to the date that has been inputted, in a cell 3 to the right of it, and change that cell colour to blue, which to me would indicate the next due date.But if the colour was red then it needs a date +30 into the cell next to it on the right.

What I also need is it to ignore placing the blue cell if you then change that to green, i.e it's been completed.