Excel 2010 :: VBA Code To Automatically Change Colour Shape Based On Cell Value

Mar 2, 2012

I have a peice of code that i know is inefficient and it is in danger of becoming too large. I have a spreadsheet that has circles aligned to each cell. There are around 100 in total. The code changes the colour of the shape based on the cell value in which it sits. However, the code needs changing and also it does not automatically update the colour shape even though the cell value changes. I have to manually select a cell and then the formula bar and then press return for it to update.

I am using excel 2010.

This is the code i am using for each shape.

Code:
If Range("n12").Value = text Then
ActiveSheet.Shapes("Oval 250").Fill.ForeColor.RGB = RGB(255, 255, 255)
End If

[Code]....

View 6 Replies


ADVERTISEMENT

Excel 2010 :: Change Colour Of Cell Based On Date In Other Cell?

Jan 10, 2013

I am trying to create a sheet in XL 2010.

In Column A each cell will contain a date (differnet from other cells in that column) when inspection was last done.

Column B is when the weekly inspection is due.
Column C is when bi-weekly inspection is due.
Column D is when monthly inspection is due.
Column E is when 6 monthly inspection is due.

I need a formula to change the colour of cells B, C, D & E when each inspection is due depending on the date entered in A

I am hoping its possible that the cell colour can stay for 2 days after the due date and then return back to blank after the second day.

For example if cell A1 has a date of January 1 2013 then on January 8 2013 cell B1 turns red then on January 10 2013 the cell returns back to normal.

A1
B1
C1
D1
E1

Inspection Date
Weeekly Due
Bi-WeeklyDue
Monthly Due
6 Monthly Due

January 1 2013
Change red Jan 8 & return blank Jan 10
Change red Jan 15 & return blank Jan 17
Change red Feb 1 & return blank Feb 3
Change red June 1 & return blank June 3

Ive also attached the worksheet

View 1 Replies View Related

Excel 2010 :: Automatically Change Value Based On Date?

Apr 18, 2014

I'm relatively new to Excel and I'm currently making a basic spreadsheet for my personal income/spending.

How would I make the "Earned this Month" and "Spent this Month" tabs in the top update on a month to month basis automatically?

For example, in the month of may, it would display may's values, june would be june's etc. etc.

(Excel 2010 w/ Windows 7)

View 3 Replies View Related

Excel 2010 :: Change Cell Colour Depending On Date In Another Cell

Jan 9, 2013

I am trying to create a sheet in XL 2010.

In Column A each cell will contain a date (differnet from other cells in that column) when inspection was last done.

Column B is when the weekly inspection is due.

Column C is when bi-weekly inspection is due.

Column D is when monthly inspection is due.

Column E is when 6 monthly inspection is due.

I need a formula to change the colour of cells B, C, D & E when each inspection is due depending on the date entered in A

I am hoping its possible that the cell colour can stay for 2 days after the due date and then return back to blank after the second day.

For example if cell A1 has a date of January 1 2013 then on January 8 2013 cell B1 turns red then on January 10 2013 the cell returns back to normal.

A1
B1
C1
D1
E1

Inspection Date
Weeekly Due
Bi-WeeklyDue
Monthly Due
6 Monthly Due

January 1 2013
Change red Jan 8 & return blank Jan 10
Change red Jan 15 & return blank Jan 17
Change red Feb 1 & return blank Feb 3
Change red June 1 & return blank June 3

View 3 Replies View Related

Excel 2007 :: Get Cell To Refer To Date That It Contains And Change Cell Colour Based On That?

Dec 19, 2012

I work for a UK charity and have a list of funders in an Excel 2007 spreadsheet.

One of the columns refers to the date on which a new application for funding can be made to that particular funder.

In many cases new applications for funding can't be made for 1 or more years since the last application - sometimes as many as 5 years later. How to get a cell to refer to the date that it contains.

For example, say I have in cell A1 "The Acme Funding Organisation" and in cell B1 (i.e. the "Reapply when?" column) a date of 01/04/2013 (British date format, i.e. 1 April 2013) then what I want Excel to do is to look at the date in cell B1 and if that date has been reached to highlight the cell red. That way I'll know that the reapply date has been reached & that a new application can be made.

View 2 Replies View Related

Excel 2010 :: How To Change The Background Colour In A List Box

Nov 5, 2013

How do i change the background colour in a list box?

An example is attached.

View 2 Replies View Related

Automatically Execute Code Based On Cell Change?

Sep 5, 2013

I need to be able to hide and unhide a given set of rows based on the value in a particular cell. My current code allows me to successfully do this, ONLY, when I select the cell being 'watched' for changes and press enter. It does not execute the code automatically.

The cell is changed by a set of filters that modifies the data. The watched cell is then a summation of the filter modified cells. If the filters change to all "0" or "-" then my 'watched' cell sum becomes "0" and thus should execute the code automatically.

Current Code:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Outline.ShowLevels RowLevels:=3
If Range("I62").Value = "0" Then
Rows("63:87").Hidden = True
End If
End Sub

So, right now if I use the filter and the cells change then the sum in I62 becomes "0", I have to manually select cell I62 and press enter and which point the above code executes exactly as I intend.

I need the execution part to be automatic and not have to manual click into cell I62.

View 1 Replies View Related

VBA Code To Colour Certain Cells Based On RGB Colour Shown In Cell A1

Apr 17, 2014

I have a lookup that gives and RGB colour code in Cell A1; for example 186, 206, 140.

I'd then like Cells R10:V15 to fill with the RGB colour based on the result in A1.

View 2 Replies View Related

Macros Assigned Shape - Colour Changing Code

Mar 13, 2014

I have made several Shapes and assigned macros to them, all is good.

What i am curious about: is it possible to highlight or change colour of the shape on press and return to normal if another is shape is pressed? Just anything to make that particular shape stand out that it has been selected then return to normal when another shape has been selected...

[Code] ....

That is the code so far that is attached to 1x shape...

View 5 Replies View Related

Shape Name Change Based On Cell Value Using VBA

Jul 22, 2014

I have a shape on one sheet. Need to change the name of a shapes depending on a value in cell from an other sheet.

View 6 Replies View Related

Change Shape Based On Cell Value

Jan 6, 2014

I'm tying to change a shape based on a cell value. I have this but it will not change fron green to red.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Range("A100").Value >= 0 And Range("A100").Value Range("A100").Value Then
ActiveSheet.Shapes("Oval 5").Fill.ForeColor.RGB = vbRed
End If

End Sub

I would like the shape to go red, yellow and green but I can't find anything that works.

View 1 Replies View Related

Excel 2010 :: Sorting Or Counting Based On Text Colour

Sep 10, 2013

I have a database of names in one column in excel 2010 and over time I have coloured the text of some of the names green to show that they have been added to a new online database. I want to be able to count how many of the names have been coloured so I can see if it matches with the total number already added on to the online database. I have over 800 entries so I don't want to have to manually count them unless I find I have missed any. Conditional Formatting is greyed out (it is a Shared document so that might be why).

in creating an IF (text is a certain colour) THEN 1, 0 or any others ways I can find the total in that colour. I only have two text colours in my spread sheet, black and light green.

Example of Table.JPG

View 1 Replies View Related

Excel 2010 :: Automatically Change Text Entries To Set Number ID / VBA?

Jul 24, 2014

Basically I first want to be able define around 100 variables such as:

Dog = 1
Cat = 2
Mouse = 3

And so on. The reason being my final data needs to be the numbers for it's purpose but because there are so many I can't possibly remember them all to just type out 23 | 44 | 76 | 2 etc. What I would like to then happen is that whenever I type out the words in a cell it's automatically replaced with the number ID.

So typing in

Dog
Mouse
Mouse
Cat
Dog

would automatically result in

1
3
3
2
1

In those cells when I hit enter or at the end in one go. Is this at all possible in Excel 2010?

View 1 Replies View Related

Excel 2010 :: Macro To Color Code Cells Based On Value In A Cell And Range In A Table

Dec 2, 2013

I am using Windows 7 and Excel 2010.

Is there a way to create a macro to color code a cell based on the value in a cell, and then look up a value in a table, then color code it based on where it fits into the table?

I have a table of values for about 30 projects. In column g - there is a CPI value (see bold column)

Example: Project ID
Name
Program
PMT
SI ID
AC
Milestone
TCP Level
[Code] ......

Here is the table:

I have to color code a cell, base on the CPI and how it fits into the table below. So if the current Milestone is M2 or M3 and the CPI calculated is .14 the cell would be colored RED, if the CPI number is 2.01 for M2-M3 I would want cell to be colored Turquiose. If we were at Milestone M6 and the CPI was 2.01, it would be colored blue. If the CPI was .75 at Milestone M5, it would be colored Green

LEGEND
Earned Value Limits

Milestone
RED
Yellow
Green
Turquoise
Blue

M2-M3
2.15

M4-M6
1.66

M7-M11
1.26

View 2 Replies View Related

Excel 2010 :: Add Colour To One Cell By Selecting The Other?

Apr 29, 2013

Im creating some labels for users to be able to enter data with ease. i want to add color to one cell by selecting the other. example:

if i put a (date) in cell B1 i would like cell A1 (Day) to colored once a date is in cell B1

Note: I am using excel 2010.

View 2 Replies View Related

Excel 2010 :: Cell Changes Colour As Year Passes?

Mar 20, 2012

In a whole column (starting from CELL H3 to H3000) There will be different dates. Once these dates have passed a whole year I would like the cell to turn red. Ive tried everything I can think of using MS Excel 2010 in conditioning format and formulas but cant find a answer.

Im happy to have a link to another column and just hide that column but for the end product to highlight the date that is 1yr old!

View 3 Replies View Related

Change Colour Of Cell Based On Text In Another?

Feb 1, 2013

I am trying to make a cell change colour based on the partial content of another cell.

For example, cell A4 has a alpha-numeric sequence in it and I want cell B4 to turn blue if part of the sequence is ABD or F&C.

View 1 Replies View Related

Change Colour Of Autoshape Based On Cell Value

Mar 21, 2012

I've seen examples of VBA that will colour autoshapes based on cell values. I have a map of the UK made up of autoshapes that have been edited to create a shape of each postcode area such as EX, GL, NR etc. Also I have a list of all these postcode areas and I have given them a zone number (1-7) depending where in the UK they are.

PcodeZoneDH3DL3DN2DT1DY2E4EC4EH5

At the moment I have set the colours using the fill option so anything that is a particular zone is a certain colour (i.e. zone 2 is green).

What I would like to do is to set a zone to a colour, so the map will update all the zones with the right colours.

I need to be able to read the zone number that is assigned to a postcode area and change the relevant autoshape to the correct colour so that any postcode area can be one of 7 colours.

I can't attach a spreadsheet with my map and postcodes otherwise I would have.

Is there an easy way i can read the zone number of each postcode area in the list and update that autoshapes colour? Would the autshape need to have a name so it know which one to update or is this not possible?

View 9 Replies View Related

VBA Change Cell Colour Based On VLookup

Oct 22, 2012

I have found this code that, with changes, I can make work with the cells and columns I am using. What I cannot see is how to make more than one cell change colour rather than just the cell in column J.

How can I change the code below to change several cells in the row? I will be using cells in columns A:F.

Data will be entered into the rows from A2 to E2, in F2 a vlookup will enter one of the values, "High", "Medium" etc.

Each of these values has a colour assigned. The code below, with alterations, will be able to colour the cell in F2 depending on which value is entered. I need the whole row from A2 to F2 to be coloured.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim ChangedRange As Range
Dim r As Long, iCol As Long

Set ChangedRange = Intersect(Target, Columns("F:H"))

[Code] ......

View 5 Replies View Related

Change Cell Colour Based On 3 Values

Jul 18, 2006

My question is i want a cell to have the colours:

Green=if within the max min range [as specified by user]
Amber=if the current value is less than the allowable slack level[again specified]
red=if the current value is less than or more than the min or max respectively.

View 4 Replies View Related

Change Cell Colour Based On Expiry Dates

Nov 13, 2013

I am trying to change the colour of a cell based on the expiry date. I know I need to use conditional formatting but Im having trouble.

Colomn E from row 5 to 1200 have dates in them from as far back as 08/2013. I need to change the cells so they turn yellow after 28 days and red after 45.

E.g. 1. E953 has a date 07/09/2013, I need it to change colour as above, 28 days and 45 days.
2. E961 has a date 04/10/2013, I need it to change as above, 28 days and 45 days.

Can I formulate the entire E column so when I put a date in, the formula will automatically start.

All the other formula's I've seen involve starting from "today" or "now" .

View 9 Replies View Related

Change Cell Colour VBA Based On Text String?

Oct 11, 2011

I need to change the colour of a cell using VBA based on the input of a certain word. I have used teh below code but it doesn't pick up different variations of the word

Dim cell As Range
For Each cell In Range("E2:E500")
If cell.Value = "Check" Then[code]....

This code works fine (i have put it into worksheet change) when I use "Check and Mark and Chase" but some users are bound not to use capitalised first letters and on these occasions the cell colours are not changing.

How to add something to thie code above to make it work for any variation of capitalisation?

View 2 Replies View Related

VBA Code To Change Font Colour Of Cell Referenced Letter Strings Within Range Of Cells

Jun 13, 2014

I am working on a spreadsheet for work, and have managed to do everything I need to so far but I need to colour specific letter strings, certain colours within a range of cells (each letter string will only appear once on each sheet)

The strings I will be looking for vary depending on data entered so I will need to cell reference them

The strings that need colouring are in cells with other strings that must stay black (They cannot be separated from other strings due to the nature of the grid)

I need some strings red, some green, and some blue.

These changes should also apply to the whole workbook not just one sheet.

Is there a way to do this with the VBA code.

View 3 Replies View Related

Change Cell Colour Based On Number Of Days Before Date?

Jan 17, 2014

creating a cell to show: no colour unless
date minus 90 days as amber
date minus 45 days as red

View 6 Replies View Related

Change Colour And Values Of Cell Based On The Value In Adjacent Cell?

Nov 10, 2012

I need to write a condition in such a way that cell IF A1= "DBR","BPR","SLR","SKR" then change cell B1 to SPECIFIC COLOUR Each condition different colour. A1 values ("DBR","BPR","SLR","SKR") is a list of selectable values. if the condition is falls then B1 should be normal (white color cell) with 0 in it.

View 1 Replies View Related

Excel 2007 :: Current Time Causing Cell To Change Colour

Jun 4, 2014

I am creating a spreadsheet in Microsoft Excel 2007 which holds information about the airline Emirates which I have created using information from the internet. I am currently creating a sheet which has all their flights in and holds information about the departure time and arrival time of the flight and the type of aircraft ect. I am wondering if there is anyway in being able to have the cell which has the flight number in to change colour (Green or Red) if the flight is in the air or not by using the departure and arrival times already set on the sheet. I am wondering if you possibly need to have a live time on the sheet so that it can work with that .....

View 1 Replies View Related

Excel 2003 :: Conditional Formatting Not Working And Cannot Change Colour Of A Cell Or Writing?

Sep 23, 2013

Excel 2003

On one of our computers at work, Excel is acting especially strange. The conditional formatting in Excel on one of our computers is not working. In addition, we cannot fill a cell with any color or change the color of the writing. We can click a color for the letters and type it in, but immediately after another cell is highlighted, the writing goes black again. When we try to highlight multiple cells with the cursor, the cells are black instead of the normal color. This happens to not just spreadsheets that are new, but existing spreadsheets on our shared drive from only this one computer as well. No other computers are affected this way. All other computers show the spreadsheets fine and do not have any functionality issues.

View 5 Replies View Related

Automatically Colour Code Cells

Sep 25, 2009

Is there a way to automatically conditionally format each column in each row, when either open, closed or cancelled is selecting from a drop down in the Status column. For example every cell is blank in colour, but if I select open in the drop down menu for row A2, the entire row will turn Red. Just wondered if there is a way instead of individually formatting every row separately. I would like to be able to copy the formula or whatever down the entire sheet.

View 2 Replies View Related

Excel 2010 :: Adding Colored Shape (rectangle) To Footer?

Dec 19, 2012

I need to add a colored rectangle or box to a page footer in 2010 Excel.

View 2 Replies View Related

Excel 2010 :: VBA Loop Code To Automatically Email Range Of Cells And Email Addresses

Sep 16, 2013

I am using Excel 2010. I have been given a task at work that can save my team a lot of time if I can solve the problem. Every month, we have a spreadsheet with about 5000 rows that we have to email. In each row, there is a range that we have to email to a specific email. For example, I would have to copy and paste Range A2-R2 in the body of the email, and then email it to whatever email is in cell S2. I would then continue this for the next 5000 lines, making it a possibility that i will be sending 5000 emails manually.

I have been trying to come up with a solution through VBA that would automatically send these emails. My goal is to automatically send the Range A2-R2 to outlook email, then cell S2 into the "To" email address box, and then automatically send it. So far, i have successfully been able to send one row, but cannot figure out how to loop it for the remainder of the rows.

A couple other key points are that I have column headings as well (Range A1-R1). If possible, I want to be able to include the column headings in the email body as well. Example - first email would be range A1-R2. second email would be range A1-R1 and A3-R3, and so forth. The body of the email would also contain a standard script, such as "Please review the information below."

The goal here is to save everyone from having to send 5000+ manual emails. This would be a big boost for my team.

Code:

Sub Email()
Dim rng As Range
Dim OutApp As Object

[Code].....

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved