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.
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?
I have been trying to make it so that an autoshape changes colour according to the value of a particular cell but every time I run the macro the shape is black and I cannot work out why. The code is -
Private Sub CommandButton1_Click() Dim X As Integer X = Range("H5").Value With Sheets("Sheet 1").Shapes("Rectangle 1").Select Select Case X Case Is > 0: Selection.ShapeRange.Fill.ForeColor.RGB = 2 Case Is < 0: Selection.ShapeRange.Fill.ForeColor.RGB = 3 Case Else: Selection.ShapeRange.Fill.ForeColor.RGB = 1 End Select End With UserForm2.Hide End Sub
I am atempting to do some autoshape conditional formating. I am about above average when it comes to working with Excel, and I know little to some Visual Basic. Here are the two things I am attempting to accomplish.
1. I am attempting to use VBA to change the color of a Large Pyramid Autoshape called "JanPyramid". The thought behind this is, I wish to have the Pyramid show vbGreen when it is <= my target (which in this case is a user inputed cell called "RECTARGET", so instead of using a number in my VB code I would like to have it refer to this cell in E58) I want the Pyramid to show vbRed when the total Recordables (this number is generated by using a COUNTIF function, so it counts all entrys in the table that have REC entered for its status, in this case the cell is called "RECCOUNT" and is located in I54) is > my target, E58 "RECTARGET"
2. I have already sort of gotten this to work by using values instead of using cells. But it is still is not perfect. I would prefer to use the actual cells because my targets and the actual counts can be different depending on what happens during that month. Here is the code I have in so far, it is with the values instead of it being the cells because I do not know how to make it read the cells instead of values:
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("RECCOUNT")) Is Nothing Then If IsNumeric(Target.Value) Then If Target.Value > 0 And Target.Value <= 2 Then ActiveSheet.Shapes("JanPyramid").Fill.BackColor.RGB = vbGreen ElseIf Target.Value > 2 Then ActiveSheet.Shapes("JanPyramid").Fill.ForeColor.RGB = vbRed End If End If End If End Sub
This code is a hybrid from this Ozgrid thread: Changing fill color of autoshapes based on cell numeric values.
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"))
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.
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?
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.
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.
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
I have created an employee schedule with 26 pay periods. Each pay period has its' own worksheet for scheduling employees.
To navigate to the worksheets I created a home page on one of the worksheets and would like to create an AutoShape for navigating with a hyperlink based on the pay period which is selected in cell B3. When the autoshape is clicked the user would go to the correct pay period worksheet.
For example Home Page:
Cell B3 contains drop down list of the 26 pay periods which the user selects the proper pay period (ie. 8Jun14-21Jun14) Cell E3 is a cell reference on the sheet A1 Cell B6 contains hyperlink formula =HYPERLINK("#"&"'" & B3 & "'!" & E3) Autoshape has formula =B6
When I click on the autoshape the hyperlink does not work.
I have an autoshape rectangle which is linked to a cell on my spreadsheet. This cell will auto update whenever i type a number into a different cell (match and index formula).
I want the colour of the rectangle to be green, amber. red or black depending the value my formula brings back. I have managed to do this but the colour does not automatically update. Also when the colour goes black i will need the font in the text box to be white, at all other tines it will be black.
I have a simple due date spread sheet for tasks that need completing at work. I am able to make the 'Due date' cell turn red when it is equal to or less than todays date, using conditional formatting. No problem.
I also have a 'Date closed' cell which is populated with a date when the task is complete.
What I am struggling to do however is change the red 'Due Date' cell to Grey once the 'Date Closed' cell is populated with a date. In fact I would like the whole row to be greyed out once the 'Date Closed' cell is populated.
I also have an 'Open / Closed' cell, which tells me if a task is open or closed, being chosen from a drop down I installed. Could this be used as an alternative to the 'Date Closed' cell. ie If someone selects 'Closed' in cell A4 the whole A row goes grey.
I dont have that great knowledge in Excel but i wanted to try and run a macro in an IF formula but realised that was not possible. I have now got a formula that gives a value in a cell when i want the whole row to turn to red, but im not sure how i can get a macro that will change the whole row to red when that cell shows a value. Can anyone help on this matter?
How I can change the background colour of cell C:2 depending on what other cell i click? Below a sample of the code im using Basically when i click B:2 i want C:2 to turn grey with the text on top.... Then when i click B:4 i want C:2 to turn Red.....
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Select Case Target.Address Case Is = "$B$2" Range("D2").Value = "No action needed connector is down" 'change this to suit Case Is = "$B$3"
I would like to have the colour of a cell change within a spreadsheet anytime that a change has been made. I have used the worksheet_change function to change any text that has changed in a cell, however I would like to have the actual cell colour change if someone deletes anything from that cell. I figured that I could use the worksheet_change function for that as well however it is not working.