Using VBA To Select A Row And Colour Code It Based On Conditions

Feb 10, 2009

I've had a look through the forum and can't see an answer, so apologies if I'm duplicating something!

I have a spreadsheet where column O has five conditions:
1 PO in
2 High Probability
3 Medium Probability
4 Low Probability
Blank

I need to colour code the whole row based on the value in the cells; if there were four conditions, I could do this with conditional formatting, but with five (with white as the fifth condition), I need to look at VBA.

However, I'm having difficulty colouring the whole row; how do I do this?

e.g. what I need to do is:
If O2 = "1 PO in"; Select A2:T2; Colour green

In addition, I need to ensure that if there is no data in column D, but column O is "1 PO in", it is highlighted in a separate colour. I have a macro for that, but don't know whether in needs to be put into the code before or after the macro needed above...

View 9 Replies


ADVERTISEMENT

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

Colour Cell Based On Few Conditions / Cell Values Of Other Cells In Same Row?

Jun 28, 2014

In the xls for each step I have 2 raws-planned and actual. Step planned duration is populated manually over the weeks.Before that row we have another reflecting the actual step status per week

I would like to find a way how cell reflecting the actual status of a step can be automatically populated (coulored) based on the colour/value of activities that are planned for that week and for that step.Activities are listed below the step and again have planned and actual row.

The rule should be : if for a week we have several activities all of them should be finished in order to have step stataus auto populated as green. If a single activity planned for that week is not done-then weekly step status should be red.

The activities for each step are grouped below the step. It seems that one of the difficult part in that request would be how formula will understand where starts and finishes the activities that belong to one step. To get that happen I placed a column showing step and another column where we activity.

View 9 Replies View Related

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 View Related

Changing Cell Colour On Certain Conditions

Sep 15, 2009

I am an Excel newbie and would like your help to develop the attached spread sheet. I would like the colour of cells A4 to H4 to change colour when the date in column B is plus 10 days and the same to happen to A5 to H5 so on and so on

I would also like the cells A4 to P4 to change colour when a quote goes to become an order an we enter data into J4 to P4 again the same thing to happen in subsequent lines as data is entered in the relevant line.

Basically I want a quote of 10 days or more to show as a different colour so that an employee can chase the quote. Once the quote become a firm order I want the cells to become a different colour again.

View 13 Replies View Related

More Than Three Colour Conditions In Conditional Format

Apr 15, 2009

We have 6 words we need to add to a sheet, each cell needs to be a different colour on the basis of the word.

I was hoping to use CF as the sheet needs to be locked against people editng cells and the like.

My question is, could a conditional format say if "service" colour blue, if "parc" colour green.

If this is possible this would allow me to use 6 different colours.

View 9 Replies View Related

Excel VBA Code To Select A Range (rows) Based On Values And Delete

Aug 8, 2013

I am trying out with a code which checks for cell value as "Select" in column IU and then checks for corresponding column IV for value as "0". Please note that "Select" and "0" are populated by formulas. I need the select "Select" and "0" till the next "Select" occurs in column IU and delete the selected range and continue the process until last non empty cell based on column C.

I have written the below code but it doesn't work.

Code:
Public Sub Test()
Dim nRow As Long
Dim nStart As Long

[Code]....

I could have uploaded the excel file that I am working on but did not find any upload attachment option.

View 1 Replies View Related

VBA To Select Cells Of Certain Colour

Jan 26, 2009

I need a fast procedure to create a range variable which comprises of non-adjacent cells which have an interior color of yellow say, within one sheet.

View 9 Replies View Related

Select A Cell By Colour

Jan 31, 2009

I want to select the only cell in Column A (there will only be 1) that has the colour index 15. I don't want to do anything with it other than select it. I've searched this, and many other sites, and everyone wants to changes colours or use CF, I just want to select it using VBA so I can use it in a macro.

View 9 Replies View Related

Select Cells With Yellow Colour

Mar 11, 2007

Need faster way to select those cells (non-continous) that highlighted with yellow or read colour.

View 2 Replies View Related

Formula To Select Value That Satisfies Conditions

Apr 3, 2009

Need a formula that will use column F as a reference to find out if there are 3 previous wins and show the value of FG (H column) and if not it should return just a character ("-" eg). For example in our case the end result should be what is shown in column J. The problem I have is that the sheet contains a break in stats after every 20 games and more conditions have to be added to accomodate this and have not been able to succesfully do it. You can use other columns (as shown) for references if it is easier. See column L for what I have come up with but it does not quite work as I wanted it - as it shows a false where it should return just "-" and also in the row after the last data entry it shows a 0 instead of "-". Table gets updated.

Any other solution (not using IF function) would be fine as long as I get the end result in column J (as shown).

View 10 Replies View Related

Select And Show A Table With Conditions?

Feb 13, 2014

I have a table with a lot of fields ( Date, Type, Name, Status ...etc). I want to make 2 textbuttons to put the Date intervals and a combo box to put the Type possibilities. After i put those condition i want to press a button to show only rows (from initial table)who are between data i entered and with kind of type i select.

View 1 Replies View Related

More Than 3 Formatting Conditions - Select Case

Dec 11, 2008

I have 5 formatting conditions that I need to add in my macro and have just recently found out that I can't have more than 3 in my version of Excel - DOH.

Anyway, some research has indicated that you can use something called select case to get round this?

I need to colour the range as follows:

View 14 Replies View Related

Colour Code

Aug 10, 2009

I have created a Sales Data spreadsheet which is updated by 10 members of our sales team. We also have a master sheet which gets updated the moment the individual sheets are updated by the sales team.

I want to know how I can differentiate the new entries with the old ones. Is there a code I can insert in the Master File which would change the colour of the new entries, say for example, all the rows with the date field “August” should automatically be changed to yellow. Similarly all “September” entries should automatically be coloured Red.

View 14 Replies View Related

Print VBA Code In Colour

Aug 23, 2007

I have a really simple question - am tryingto print my VBA code, but want to print it as it appears in the VBA window, in colour (i.e. green comments, blue operations, etc). Is there a way to set it so the code prints in colour?

View 3 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

Find Average Of Different Columns And Colour Code It

Feb 27, 2014

I have the following code to go through various values in a column and colour code them. However I am facing two issues here:

1. I need to generalize the code such that it runs through column G till column S in different worksheets

2. Few columns between G and S do not have any data and the code is getting stuck at the line below:

myResult = WorksheetFunction.Average(Range("G:G"))

View 1 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

VB Code To Find Instances Of Text In Worksheet And Colour Entire Row

Aug 21, 2012

I'm trying to develop code that will perform the function in the title. I want to use an if statement that looks at cells across the worksheet and where it finds certain text it should colour the entire row. I would also like to be able to input the text via a user box. I don't necessarily want the code

View 3 Replies View Related

Code To Colour Cells Dependent On Reference To Adjacent Criteria

Jun 11, 2014

I have developed the following code to colour cells dependent on reference to adjacent criteria (in Col D).

Is there anyway I can simplify this code to avoid three separate "For each" statements?

Code:
For Each c In Range("E12", Range("e" & lastrow))
If c = "" And c.Offset(, -1) "" Then
c.Interior.ColorIndex = 7

[Code] ..........

View 2 Replies View Related

Sum Based On Colour

Oct 16, 2008

i'm currently using some VBA code to insert a formula and sum certain rows. Which rows to sum is determined by the following line...

View 5 Replies View Related

VBA Code. Check Multiple Conditions

Jul 22, 2007

I want to create a user form in excel that auto calcs the discount depending on customer type and no. of books purchased. There are two types of customer’s one individual and the other schools, library etc. The discounts are below

More than 50 books - 30%
25 - 49 - 20%
15 - 24 - 15%
5 - 14 - 10%
<5 - 5%

Individual
>25 - 25%
5 - 24 - 15%
<5 - 0%

I have created a form with option and text boxes to capture data but am really struggling with this as in my head I understand a set calculation will need to take place once relevant conditions are met but am really struggling to put it into code (yes I am new to this).

View 2 Replies View Related

VBA Cell Colour Based On The Value

Sep 24, 2009

I have a userform that outputs data to a worksheet. One of the textboxes contains either one of 3 values, either: N/A, Debit, or Credit. This textbox is called "tbDebitOrCredit".

What I need is, when the the user clicks the "Submit" button and the data is output to the worksheet, the cell that recevies it output from "tbDebitOrCredit" turns a specific colour based on the value.

For example:

N/A = White
Debit = Red
Credit = Green

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 When Select Cell

Oct 26, 2009

I have VBA code that changes the cell background colour in column A based on criteria in column B. What i want to do is select a cell in the same row in a range column O:AB and change the background colour to the same as column A. This action is for rows 4 to 41.

Basically i just want to click in a cell and for that cell's background colour to change and match the colour in column A.

View 9 Replies View Related

Code To Recalculate Certain Cells Only Meeting Certain Conditions

Nov 30, 2006

I have two sheets. Watchbill and Roster. The Roster contains a list of names that are randomly generated to the watchbill sheet into more than 60 seperate cells. My problem is the names are not being distributed fairly. If I had 20 names and 20 cells, it only uses say 12 of them and repeats 8 names, thus leaving 8 persons out of the generation completely. I did not know how to fix this so I used a system to identify when a name was repeating in the series of cells by displaying Repeat in the cell beneath it. I then had the names that were not placed on the watchbill (the other 8 not used) highlight themselves in blue on the roster sheet so I could manually insert them on a third sheet into a cell set to override the repeating name on the watchbill. This was my back door system to solve my repeating names problem. However this takes forever. I want some vba that will identify the cell with the "repeat" underneath it and automatically recalculate the cell until it doesn't repeat. I only want the cell recalculated, not the sheet. This code would have to do this for about 70 cells making sure no names repeat at all, unless there isn't enough personnel to fill the positions, then it would allow the names to repeat. Can that be done and what would the code be?

View 14 Replies View Related

Colour Columns Based On Data

Apr 13, 2013

I have a sheet (calender month) with week number in the top row, date on the second and weekday on the thirdh.
Is there some code that will change the background colour of the entire column when the weekday say's sa or su (saturday/sunday)?

I could do it manually but every year the first of januari starts on a different day and I would like to automate it.

View 9 Replies View Related

Colour Cell Based On Date ..

Feb 11, 2009

It's quite funny that i'm asking this cause I answered a similar quesstion earlier. But I can't seem to get my head around the thinking of this one.

I am trying to create a formatting so that if todays date is greater than the date in the cell the cell is coloured red. And if todays date is > today()-14 <today() the cell is coloured yellow.

I don't think it is as simple as using conditionaly formatting, it may well be but like I said I can't quite get my head around what I need to do.

View 8 Replies View Related

Sum Values Based On Cell Colour

Jun 18, 2008

Can you sum cells based on colour, and if so, how do you determine what code/number your colour is to input into the programming?

View 13 Replies View Related

Find And Add Based On Font Colour

Aug 14, 2009

I humbly seek help on the "Find and Add based on Font Colour". For instance, A1="urgent"(with red font) and I want B1 to return as "ATTENTION". Other than red font, it will return as empty string. Can Conditional Formatting do the task?

View 9 Replies View Related







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