VBA Conditional Formatting - Apply To Two Columns

Jun 27, 2014

I have a conditional formatting issue, using VBA.

My conditional formatting code works fine for one column; however, when I try to apply the conditional formatting to two columns, the code only applies to the first column listed. Additionally, I have two sets of "rules" that apply to the same column. One of the "rules" includes two columns. The other rule applies to only one column. I'm not sure if this is my issue, or whether I'm trying to apply the same code to two different columns.

I am trying to create a macro (which will go in an add-in, using Excel 2007) which will apply a custom format to any selected cells which have their formulae hidden (Format Cells, Protection, Hidden). A similar macro works fine for locked cells.

Here is the UDF I wrote, which returns True/False based on the Hidden status of a cell:

I have a workbook that contains 168 sheets of data (it's an extract from a PM tool) which is effectively a status report from each project in our portfolio. Contained within each status report are some financial data that shows a Plan number and a Forecast number for which I want to apply conditional formatting to this section (this is the same section for each sheet), to all the 168 sheets without having to go individually into each sheet. I have searched here and all the varying responses to a similar situation as mine, do not cater for the number of sheets that I have. And I need to do this on a monthly basis at monthend. So in the example below I want to apply conditional formatting if the Forecast (Cols D & G) are greater than Plan (Cols B & E). Is there a way of doing this just with the conditional formatting or would it need a VBA script?

I'm trying to find a macro to apply conditional formatting to a large number of cells,

What I would like to do is when cell E96 has a value of a, cells E3:F95 are shaded in grey. Then when cell G96 has a value of a, cells G3:H96 are shaded in grey, and so on down to IU96 having a value of a and cells IU3:IV96 shaded in grey.

I have created an excel file that contains a lot of worksheets which contain a lot of raw data and charts. There are 5 different tabs for 5 different companies. Each tab currently contains only 1 year of raw data for that company. Then I have another excel worksheet that has nothing but charts on it. Each chart is a bar chart that shows each of the 5 companies. It also shows the current rate for the month for each company and the 12 month average for each company. On the chart there are also 3 lines. There is a standard line that we try to meet each month. There is also a line for the upper control limit and a line for the lower control limit. Here is my problem:

The 2 bar charts (current rate for the month & the 12 month average) are created and updated by the raw data in each of the 5 data sheets.

Based upon the values in each of the cells that create and update the bars on the charts themselves:I want the bars to be RED if the values are below the lower control limit.

And I want the bars to be GOLD if the values are above the upper control limit.

And I want the bars to be green if the values are in between the upper and lower control limits.

I need to run a loop through a column of values (attachment col B) and when it finds a "J" it will apply conditional formatting to a row of 4 cells directly adjacent. The attachment is a theoretical before & after.

Column b in sample is conditionally formatted based on it's values. I want to also apply that same formatting to the person's name in the chart in D2:I9. For example, Jeff is in bottom 50% so cell B2 is shaded red with red text. I would like to apply that same red shade and red text to all the cells in my chart that say Jeff. Also, as example, all of the cells in my chart that say Kelsey would be formatted with green shade/green text and so on...

I have a spreadsheet and I want to color particular cells in a column with a new color - i.e. any new changes need to be highlighted. I know there's a way to do tracking changes in excel, but it just sticks a little flag almost invisibly in the corner of the cell. I want to be able to bring the spreadsheet back to our administrator and say hey the stuff in red is new.

On a related note - I am working on this massive spreadsheet that is a .csv but I am saving it as an exel spreadsheet - is that ok? I am assuming that if I save it as a csv, it will return to the original formatting just without the colors, filters, etc changes I made - which is fine because I think somehow the .csv file will be uploaded to the system and no further changes need to be made.

I found out the hard way when you have a .csv file and make changes and then save it, you lose all the fun row/column size adjustments, color, etc - but I figure in the meantime I'll work on it as a excel spreadsheet and then return it to it's natural .csv file status.

I am having trouble getting some conditional formatting to apply to all cells in a column in a pivot table. Currently, the conditional formatting is only applying to the top level items in the pivot but is not applying to the lower level items. I can see why it is doing this. the range in "Applies to" is only specifying the rows that contain the top level items. I tried to change the range to D10:D647 but, it reverts back to just the top level items. How to get it to apply to everything?

I am trying to use the status of Conditional Formatting to toggle on/off protection for a cell.

I have a cell with Conditional Formatting applied if the result of a formula is true. If the Conditional Formatting is applied, I want the cell protection turned on so a user can not change the entry in the cell. If Conditional Formatting is not applied (false), cell protection is turned off and the user may edit.

I have ammended the colours to 4 colours that I need for a risk assessment tool . I have added a second worksheet and put a dummy sample of my table there. Can you help me with how to put two colums of conditional formatting in the sheet? The risk rating before and that after the risk treatment? Many thanks in anticipation. I have highlighted in yellow the columns where the product of the consequence and likelihood is likely to be and this is where the colour coding needs to be applied. if you can help with putting the solution in the spread sheet that would be a great help. Any reply via this forum or via my email would be greatly appreciated.

I am new and I hope I have not made a mistake in starting a new thread. Sorry if I have but I wanted to bring this up as a new post so I get a sooner response.

I have what I think is a pretty complicated issue. At my job, we have a running and constantly changing list of jobs that we have to work on throughout the day. The job management system is really unwieldy and it’s often hard to tell what exactly we have to do today and what can wait until tomorrow. So a few times a day, I export the list to an excel doc, which I’m trying to set up with conditional formatting to highlight as green the stuff for today, ghost back what can wait, and leave white and blank the cells that don’t have any info in them. I but the attachment system wasn't working for me, so I can't provide the example I've been working on.

So far, I’ve managed to set up a formula in the conditional formatting that takes into account column C, but I need to take into account information in columns B, C, and D to determine if the job line should be highlighted or dimmed. Column B is the job's title and it is just text, column C is the Begin date, and column D is the due date. here’s what I need the conditional formatting to do.

If the begin date in column C is Today at 9:00am or earlier, and the due date in column D is today, I need to highlight the column. I managed to figure out the first part of this formula, but don’t know how to keep the line from hilighting if the due date is tomorrow: =$C2<=TODAY()+TIME(9,0,0)

The second part is that I need to hilight jobs that begin and are due today (have today’s date in columns C and D), regardless of what time they have if the task title in column B starts with “Rework Request from PS” or “Rework Request from QA"

Ideally, I’d like to change the text color to something nearly white to sort of hide the jobs that don’t need to be done today, and I figured that part out based on the formula I did manage: =$C2>=TODAY()+TIME(9,0,1)

apply this to the whole sheet so I can paste the report into it a few times a day without having to rewrite the formulas in a new sheet every time, and the number of items does change throughout the day. However when I do, the empty cells turn green as if they’re due today, and I can’t figure out how make them stay blank.

I'd like to compare two columns of data and highlight where a value doesn't occurr in both columns. The problem I have is that one of the columns uses * around the text to ensure it catches all variations of the value.

I have the following formula which would work if the data was exactly the same.

=COUNTIF(lst2,value)=0

However, these *'s are meaning it never works.

Is there a way to make it so that if the values with the *'s are not found in the 1st column of data, conditional formatting is activated?

I have data in cells A2 - N2 and cell O2 is currently blank. I am trying to set conditional formatting where if O2 has a value entered into it, it will conditional format A2 - N2 and highlight the entire row red.

I tried a formula like =O2"" but that does not work. Also tried a few other things but no luck.

Also, once the formula is set, what is the best way to apply the conditional formatting to rows 3 - 30. I tried the format painter tool but that seems to want to extend the formatting range from rows 3-30 and not just per row.

conditional formatting in Excel. I have two columns with pertinent information. I need to know the following and format accordingly:

1. Is the number in column A positive or negative?2. Is the number in column B less than 0.05 or 0.10?

I would then like Column C to just be highlighted a certain color depending on the combination... there are 5 possible combinations and I would like the cells to be formatted so that:

1. Positive and less than 0.05 - Bright yellow2. Positive and less than 0.10 - Pale yellow3. Negative and less than 0.05 - Bright green4. Negative and less than 0.10 - Pale green5. This "combo" just means the criteria wasn't meant... which is possible b/c sometimes Column A may have text instead of a number of b/c the number in column B is not less than 0.10. If either of these is true, I want the cell to remain blank.

I want to format 3 columns in excel depending on certain value from another column.By example: I have the columns A B C completed with some text. On the column D it will be the numbers 0 or 1. If the number is 0 the background color from A,B,C columns shall be Green, if the number is 1 the color shall be red.

I have tried in conditional formatting with the formula =$D$1=0 but the color of the columns are changing only depending on the value from cell D1. I don't know what is the correct formula. For column A1 I want to check the value from D1, A2 - D2, A3 - D3,...,An - Dn.

How do I select certain columns for duplicate values? When I go to conditional formatting>highlight cells rules>duplicate values it checks the whole sheet which is 20 columns by 50000 rows and freezes the PC. I just want to select certain columns for duplicates, like C and AC.

I am using Excel 2003. I have a spread sheet and I am trying to use conditional formatting. But I can't figure out how to use conditional formatting across multiple columns and so I have been doing each column individually which has been kind of a hassle. I also am trying to figure out how to put in a formula so that every occurrence of a certain text will show up a certain color. I know that I can just do "cell value is", "equal to" and click on the cell, but the information in this spread sheet is organized alphabetically and is going to be added to frequently therefore every time I add information it re-organizes. This then messes up my conditional formatting because the text value that was in the cell gets bumped up or down.