Colouring Many Cells, Depending On The Value Of One

Mar 28, 2007

I'm trying to automatically shade a number of cells dependant on the value in a single cell. ie. If D2="quote" then I want A2:Q2 to be yellow. If D2="Design" then I want A2:Q2 to be green etc etc. I have about 6 options in all of what D2 could be.
I then want to repeat this for about 200 rows.

View 7 Replies


ADVERTISEMENT

VBA Colouring Cells

Oct 10, 2008

I have a spreadsheet that contains data I import from various sources. Once the import is complete I need to colour various cells based on their contents. Normally I'd use conditional formatting, but there are more than 3 conditions so I need to use VBA (preferrably that i can turn into a macro and assign to a button to click once I've finished the imports each time)

eg: Everytime a cell content is the word "RED" , colour it red - then the same with various other colours.

Google has found me a change event piece of code but it doesnt work when you're cutting and pasting some info.

View 9 Replies View Related

Colouring Non-contiguous Cells With VBA

Dec 4, 2012

I have a rather large database that I'm trying to automate colours in, based on data that is inserted into Column 'D'. I've used the following code (with some success), but it colours columns that I don't want to colour:

VB:
Sub KeyCellsChanged()
Dim Cell As Object
For Each Cell In Range("D1:D5000")

[Code].....

That works fine - but the problem I have is that I only want to colour columns A:N, Q, T, V, AB:AE, etc. (random columns and not always together). I have already tried to replace parts (as follows), but get all sorts of errors (in particular Run-time error 1004):

VB:
If Cell = "Rabbit" Then
Cell.Range("A:N,Q, T, V, AB:AE").Interior.ColorIndex = 42

Is there someway that a line of code can determin which cells to colour in the row, or alternatively code that will colour the columns a specific colour and make them stay that colour when the first code above is used?

View 3 Replies View Related

Colouring Specific Cells Using VB

Dec 22, 2006

how I might be able to colour certain cells in a row a specific colour when a specific value is input.

For instance:
The value "A" is put into row A1. A1 and C1 cell colours change to green
The value "B" is put into row A2. A2 and C2 cell colours change to orange
etc. (not sure how many colours yet)

I sort of have a script set up, but there are certain things I dont know how to do. Like target the specific cells that need colouring.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 0 Then Exit Sub
Select Case Target.Value
Case "A"
Target.Interior.ColorIndex = 1
Case "B"
Target.Interior.ColorIndex = 2
Case "C"
Target.Interior.ColorIndex = 3
Case Else
Target.Interior.ColorIndex = 0
End Select
End Sub

View 9 Replies View Related

Colouring Cells Based On Date?

Feb 28, 2014

I am currently using a piece of code (within a bigger piece) that colours the dates in two columns based on how close it is to the current date. It works fine but sometimes the sheet it is looking in has over 3500 rows so it is taking for ever (well over 6 mins)

The code is

HTML Code:

Sub ColDate() 'date case opened
application.ScreenUpdating = False
Dim MyRg As Range
Dim F As Range
Dim DateDiff As Long
Set MyRg = Range("g1:h" & Range("H" & Rows.Count).End(xlUp).Row)
For Each F In MyRg

[code]...

View 1 Replies View Related

Auto Colouring Cells Containing Formulas

Jul 23, 2006

auto colouring cells containing formulas

View 2 Replies View Related

Colouring Cells To Show Academic Achievement

Apr 16, 2006

I'm a teacher and would like to show progress in my pupils achievements by colouring coding cells in excel. For each subject they are given a level, e.g. 2b. If they show progress, they would move up, i.e. to a 2a. The whole progress scale is shown below:

wc,wb,wa,1c,1b,1a,2c,2b,2a,3c,3b,3a,4c,4b,4a,5c,5b,5a,6c,6b,6a,7c,7b,7a

To make the spread sheet visual i would like colour code the cells depending on whether progress has or has not been made. If they go up (e.g. 2b to 2a) i would like the cell to turn green, if they go down (e.g. 2c to 1a) i would like the cell to turn red. If not progress has been made then the cell can stay uncoloured. Each cells colour would only be dependent on the cell directly to the left.

View 7 Replies View Related

Conditional Formatting - Colouring Percentage Of Multiple Cells Based On Date Range

Mar 12, 2014

I am trying to get a row of cells to highlight a percentage based on a date range

Below is an example of what my spreadsheet will look like, very simple for managers to read and understand but I am stuck on how i can get this to display the right way.

In the example i would need the Jan column to colour for a certain percent for 21 days and continue to feb for 26 days. Im not sure if this makes sense but this is what they are asking for. Colour bars to simple show the percent of days off each month.

Name Start Date End Date Jan Feb Mar

Dale 11/01/14 26/02/14 21 days 26 days

I have attached the spreadsheet for an example : Book1.xlsx‎

View 3 Replies View Related

Insert Formula Depending On Cells Depending Of Variables?

Jan 27, 2014

In a macro I want to automatically insert a formula in several cells. The formula depends on other cells, and I want to be able to manipulate these cells with variables. Here is my code:

[Code] .....

All my variables are declared:

Sheets("DATOS YTD 2014").Cells(I, Semana + 1) is the cell I want to be able to chose due to the variables
Sheets("DATOS YTD 2014").Cells(I, 3) is the reference cell for the VLOOKUP formula, that will vary with I
SheetMonth.Range("B3:W172") is a range in the sheet SheetMonth which is fixed

The error message I receive is the following: "Run-time error 13, Type mismatch"

I precise that the next step is to make the ",6," part in the vlookup formula also variable... but I guess once my current issue is solved this one will be a piece of cake.

View 3 Replies View Related

Cell Colouring In

Aug 7, 2006

Is it possible to get the following to work.

If cell A2 has the number 5 in it (as a result of a calculation in that cell), is it possible to get the next five cells in that cell to colour themselves in?

Obviously, as and when the value in cell A2 changes, i need the number of cells coloured in to change as well.

In addition to this, the rows that this will happen in will vary week to week so i'm not sure if VBA is the way to do this.

Also would there be any problem with negative figures as when that happens i don't want any cells to colour in at all.

View 9 Replies View Related

Sum Range Of Cells Depending On Changeable Values In Other Cells

Aug 2, 2012

Assuming I have a data set like this :

column a column b
916 12,5
916 23,4
923 34,5
923 23,9
932 98,6
934 67,7

How can I get a sum of all cells in column b when values in column a are equal?

View 5 Replies View Related

Colouring Autoshapes Using Macro

Jan 27, 2009

Just trying to work out the best way to be able to determine autoshape colours using cell values. For example I have 12 shapes that need to coloured either Red, Green or Orange depending on a specific cells value, 1 for Red, 2 for Green and 3 for Orange.

I have sort of managed to successfully complete this for 1 of the shapes, by using the RGB Fill option (Using 3 = Red, 4 = Green and 45 = Orange). But cannot for the life of me work out how to do this for multiple shapes using different cell triggers. Below is the code that I currently have and the spreadsheet that is linked to:

View 5 Replies View Related

Reference Cell Colouring

Oct 18, 2011

How do i have colouring to a reference cell what i mean is that on certain formula i get BUY or Sell on that cell. As per the conditional formatting i have made the colour change BLUE FOR "BUY" & RED FOR "SELL"

On second sheet i link the above TEXT., but the COLOUR OF THE TEXT Does not come.

Does CONDITIONAL Formatting come with reference cell.

View 7 Replies View Related

Colouring The Row By Conditional Formatting

Aug 2, 2006

I have a gone through quite a few topics in this forum.....but couldnt find answer to my question....may be because its too basic. I have a worksheet with 10 columns. I am trying fill colour in the rows that have "text" in column J (in other words.....their column J is not blank). I figured out how to fill the colour in the cells in column J when they are empty, but cant figure out how to colour the entire row from A:J.

View 4 Replies View Related

Colouring Tabs Based On A Cell Value

Jul 28, 2009

I've been trying to get a macro together which would colour all the tabs in my workbook based on whether or not a certain value exists in a certain cell. In this case the cell is C7 and the word there is "elective class:".

View 7 Replies View Related

Colouring Cell If It Has A Specific Date

Feb 17, 2010

I have a column for each month where the dates are entered on rows. Is it possible I can color a cell if the date entered in a cell for that month is 15 days past the end of the month. Like, if in a January column I enter a date on one of the rows as Feb.20, then the cell fills with red colour. I tried doing it using conditional formatting, but don't know how to say 15 days past end of the month?

View 5 Replies View Related

Colouring Lines Of Text In Comments With VBA

Aug 2, 2008

I currently have some code which reads a stock file, adding up the stock for each individual item (which may be in one or more locations in the warehouse) and then placing the total stock count in a cell with the detail (of how much stock is in each location, the location and the expiry date) and a separate line for each location, in a comment.

The comment is constructed one line at a time as the code finds the stock records, see code below:


With shtWorking.Range(strStartColumn & intRow + 2)
oldComment = .Comment.Text
.Comment.Delete
.AddComment oldComment & vbNewLine & strComment
.Comment.Shape.TextFrame.AutoSize = True
End With
All this works very nicely, but I want to colour individual lines depending on the expiry date. This can be done manually in Excel, but I cannot find a way of colouring individual lines of text in a comment using VBA.

So, does anyone know of a way I can colour individual lines of text in a comment, using VBA?

View 9 Replies View Related

Colouring Cell Based On RGB And Index Numbers

Jan 28, 2014

As you can see from below I already have a spreadsheet which updates the fill colour of cells based on a certain criteria. This was initially set up in Excel 2003....I have now moved onto 2010 and want to use a certain colour based on it's RGB value. I tried as you can see from below, the part which is commented out (as it didn't work)

Code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim n As Long, lngIndex As Long
For n = 6 To 842

[Code].....

View 3 Replies View Related

Colouring Tabs Dependant On True / False Condition

Feb 21, 2010

I have "borrowed" the below code from a previous solved post, however am unsure how to adapt it.

View 7 Replies View Related

Getting Value Depending On Changes Of 2 Cells

Jul 10, 2014

I have an issue with this for a couple of days actually..

I have to find in a certain date "column C" if User "column D" changes from the initial user's number to another one to gave me the first half sales of the day and then obtain the other sales of the other part, this must reestart again when the date changes.

I have to know what was the sales on the two parts of the day and then in column Q assign "Manana", S1 Cell or R1 Cell for second part of day

The User "column D", can be diferent each day.

I attach the excel data to get a better explanation on this.

Mov may-jul FARMAX.xlsx

View 7 Replies View Related

Conditional Formatting Depending On Two Other Cells?

Jan 27, 2014

On the attached spreadsheet, is there a way of highlighting a cell because it is a greater number than two other cells?

Can cell C3 be highlighted green because the number is greater than G3 and K3?

Can cell E3 be highlighted green because the number is greater than A3 and I3?

Can cell K4 be highlighted green because the number is greater than C4 and G4?

View 8 Replies View Related

Hyperlink To Other Sheets Depending On Cells

Jan 6, 2009

how I would do the following, as I have been having a play but not managed to get anything.

I have two cells, C10 and C11, they both contain numbers. I want to create a hyper link that goes to the sheet called: Semester C11 Year C10

e.g. if the cell values are 2 and 1 respectively, I want the link to go to the sheet called 'Semester 1 Year 2'

View 9 Replies View Related

Seperate Cells Depending On Content

Jun 24, 2009

I have some workbooks that have some serials in A row and i need to seperate them depending on how many digits they have,

For example some have 13 digits,and some 8.I just want to seperate them into different rows.

Here is a sample

seperate sample.xls

View 5 Replies View Related

Display R, A Or G Depending On Text In 2 Other Cells

Apr 15, 2009

I am trying to nest a formula with IF & AND to work out a RAG status. I have 2 questions per row (in Columns I:J) which will be answered either Yes or No. For each combination I need to give a RAG status in Column K – e.g. two Yes replies give Green, 2 No replies give no and one No out of 2 will give Amber

Below is hoped for response in Column K:

ColI---Col--- JCol K
Q1----Q2----RAG
Yes---Yes---G
Yes---No----A
No----Yes---A
No----No----R

View 3 Replies View Related

Sum Several Cells Depending If Satisfy Several Criteria

Jul 27, 2012

I have a table with several criterias (Name of supplier, date, amount paid to this supplier). This table is my inputs. Each time I have an expense, I put down the name of the supplier and the amount of the expense and the date when it occurs.

I have another table with name of each supplier in rows and the date in column. Sometimes I have 2 amount for a same supplier for the same month. I would like this amounts sum in my table. I cant find a good formula to do it efficiently.

Obviously I can do a sum

(if(A2=B2, if(c6=c8);b10)+sum(if(A2=B2, if(c6=c8);b10)+ etc...

But I can 150 expenses per month...

View 2 Replies View Related

To Change Color Of Cells Depending On Value

Nov 10, 2008

when I execute this code on the selected cells, it completely ignores my selection, and makes the entire worksheet black.

Sub ColorCells()

Dim cell As Range

For Each cell In Selection

If cell.Value = "U" Then
cells.Interior.Color = 3

View 9 Replies View Related

'shift Cells Right' Depending On Value Of Cell

Jan 4, 2010

I need a macro that will "examine" the text of column B for every row checking to see if the text "Proper Text" is in the cell and if not, execute this code for that cell and then move on to perfrom the same until it finds an empty cell:

Selection.Insert Shift:=xlToRight
Range("B2085").Select
ActiveCell.FormulaR1C1 = "Click for detail image"
With ActiveCell.Characters(Start:=1, Length:=22).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic

Note that "B2085" above is the cell number that the script stops on to execute this code.

View 9 Replies View Related

Cut / Paste And Shift Cells Depending On Value In A:1

May 11, 2006

I am trying to make a macro to take a set of data and shift the data range down depending on the value in the A:1 cell. For example if the data in column A starts with 5, 6, 7, 8 and so on.... I would like to copy/ paste and shift the column down 5 cells so I can start A:1 at 0.....so that the data can begin as 0,1,2,3,4,5.....etc.

View 3 Replies View Related

Highlighting Cells Depending On A Value In Another Cell

Aug 19, 2006

Have a spreadsheet shows 4000 warehouse locations (location of products). Each cell is a location in the warehouse (ba050, ca809, etc, actual warehouse locations, not grid ref); some products have more than one location, the locations are always next to each other. I import a text file into the workbook which tells me which product has more than one location (2, 10, 50, etc), that’s all I’m interested in ( multiple locations).

What I’ve done so far is to use vlookup to look at locations in file and allocated the number (the number of locations that product has) next (next column) to the cell that correspond to that location. What I need is a macro or formula that will look at the number and than highlight that many cells up or down the column, according to the number in the cell to the right (5 in cell, highlight 5 cells, 50 highlights 50). The warehouse runs up one aisle and then down the next and so on. So I need to be able to highlight cells up one column and then down the next and then up, then down and so on.

Multiple locations change on a daily bases, so need a quick way of updating 4000 locations.

New to excel don’t know if this is possible or not. Learning as I go.
Need some assistance.

Sample below.
Only interested if a number is returned, “******” can be ignored as will hide all columns expect ones with locations. So:

BA020 returned value of 4, so would like to highlight (any colour) BA020, BA029, BA040, BA049.

BB780 returned value of 2, so would like to highlight BB780, BB789.

POSSIBLE?

BA090 2 BA100 **** BB749 **** BB739 ****

BA079 **** BA089 **** BB760 **** BB750 ****

BA070 **** BA080 **** BB769 **** BB759 ****

BA059 **** BA069 **** BB780 2 BB770 ****

BA050 **** BA060 4 BB789 **** BB779 ****

BA039 **** BA049 **** BB800 **** BB790 ****

BA030 4 BA040 **** BB809 **** BB799 ****

BA019 **** BA029 **** BB820 **** BB810 ****

BA010 **** BA020 4 BB829 **** BB819 ****

View 9 Replies View Related

Count Cells Depending On Certain Dates

Dec 17, 2006

I'm trying to create a sickness record book for colleagues at work, so we can monitor their absense accoridingley. I am trying to create a spreadsheet that will do the following:

Look at the dates that are over 12 months and not count those in the total occurances countCheck the dates that someones works and compare this to the absense date and automatically calculate the total time off
Are these points possible or am I wishful thinking? Just I have 60 people in a team and its hard doing them all in one go, but would be good if there is a way of it automatically doing this.

View 4 Replies View Related







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