Is there a way for a macro to capture the CURRENT colorindex value of a cell that has conditional formats? It seems to capture the default colorindex rather than the one that is currently displayed based on the conditions. I need to capture the current one.
Below is some code I am trying to run. What I would like to do is select a certain "data row" in the pivot, and apply some conditional formatting to that. It works just fine until I reach the .colorindex = 3 line. It says I'm getting an application/object defined. how to fix this? I'm on Excel 2007. This was fine on 2000!
pvtCurrent.PivotSelect "'% Dist'", xlDataAndLabel With Selection With .Interior .ColorIndex = 36 .Pattern = xlSolid .PatternColorIndex = xlAutomatic End With
With .FormatConditions.Add(xlCellValue, xlBetween, "0", "0.97") With .Font .Bold = True .ColorIndex = 3 End With End With End With
I have a Sheet ( Named "Summary" for Example ) of about 4,000 Rows that has a LOT of Conditional Formatting.
I Added Another 100 Rows this Morning and when I Tried Saving it a Message Saying that Not All the Formatting for the New Data that had Been Added had Been Saved. Is there a Macro or Something I can Run that will Make the Conditionally Formatted Cells Stay the Colour that they are but Delete the Conditional Formatting Part of it Achieved Using "Format" & "Conditional Format" from the Menu Please.
Ideally I would like to be Able to Enter the Number of Rows ( From Row ? to Row ? ) that I want this to Apply to.
I have five fields that have a conditional format applied to them: (see attached). Columns J, K, L, N and O. These conditionals highlight if a minimum number is entered. Ex. Minimum pushups for a 30 y/o male is 27, if a 26 is entered it highlights red. The total score (where I need this to perform) is calculated in column Q. It will format red if the total score is below 75 but what I can't figure out is how to make it format if any of the previous minimums have not been met.
Ex. In cell L4, his crunches were 25 (a automatic failure -- red formatting). Now the total score is above 75 so it calculates as passing (green), but I need it to highlight red regardless because of the minimum not met in cell L4.
I have a range which has conditional formats based on other cells. I want to copy this range into another sheet and retain the current formats as fixed formats without copying the conditional formulae. ideally in VBA.
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.
I am complete novice with VB so sorry for bothering with simple probably question: I need to copy cells (say column D) related to the cells with specific colorindex (say column B) into different sheet.
I have some code that runs through about 5000 rows of data looking at duplicates for column A. instead of deleting the duplicate rows, i change the font.colorindex of the cell in column a so that all cells containing xx are one color, and all cells containing xxx are colorindex+1.
Since i have about 5000 rows, colorindex limits itself to 122 (i msgbox'd each time and this is the last number i got before the subscript out of range).
Is there anyway around this, or is there a better way to pickout duplicates. remember, i can't delete duplicates, i need a way to manipulate the duplicates data once i pick them out.
I have a workbook with 25 sheets containing metric information as part of a performance management model. Fundamental to this is the visual success or failure of each of these 25 sheets which I've highlighted by setting the worksheet tab colour accordingly. The code to achieve this is detailed below. This code is triggered by the Worksheet_Change event at the workbook level and works fine in single user mode. When the workbook is shared however, an error 1004 is generated.
Private Sub Worksheet_Change(ByVal Target As Range) For Each c In Range("PassFail") If c.Value = "Fail" Then ActiveSheet.Tab.ColorIndex = 3 ElseIf c.Value = "Pass" Then ActiveSheet.Tab.ColorIndex = 4 End If Next c End Sub
I have tried to go around the long way to achieve this but came up with pages of pointless code .... I know there is a better way I just dont know enough about VB to do it myself ... And I know this is EASY for many :-)
-------- Cell ranges h11 to as11 are a totals row. If the total is 0, colorindex is set to vbpatternnone, if >= 1, then colorindex is set to vbpatterngray. Easy right ? I just dont kn ow how to do FROM/IF/DO range loops... --------
Details: The code in worksheet_SelectionChange will contain the following:
1: From range h11 to as11, variable1 = application.interior.colorindex of the cell.
2: Check if the cell is >=1 or <=0 ....
3: If >=1 then set application.interior.colorindex = vbpatterngray. Go to #5. ' (This inserts a pattern over the original color of the cell)
4: If <=0 then set application.interior.colorindex = vbpatternNONE ALSO set application.interior.colorindex = variable1 ' (This clears the cell pattern and returns it to original color)
5. Repeat steps to clear cell pattern and restore color / or insert pattern for all cells from range H11:AS11
I have an error message that says: Run time error '1004': Unable to set the colorIndex property of the interior class. I attached code for your reference.
If (Range("B10").Value = "Gift" Or Range("B10").Value = "Entertainment") And Range("C10").Value = "" Then Range("C10").Interior.ColorIndex = 6 MsgBox "Please Fill in the Person's Name & Company." Range("C10").Select Range("C10").Interior.ColorIndex = 6 End If
I have a tab called SAP DUMP where we copy our raw data to, from here we manually copy and paste into another sheet called ORDER TRACKING SHEET. When we do a fresh dump (overwrite) of raw data into the SAP DUMP tap we need to see if the there is a new entry which needs to be copied across to the ORDER TRACKING SHEET. I've got a vlookup to show this. The one I can't work out is that on the ORDER TRACKING SHEET I also need to see if there are any entries are now no longer on the SAP DUMP tab. This is where I thought a condition format might work, color the line red if it's no longer on the SAP DUMP tap. Can't make it work.....
I have a workbook with 12 worksheets corresponding to months. Each is formatted in A1 with the month (Date, Jan-01) and all rows below, starting at A5, are the days of the month (Custom, ddd d). All cells are linked so they change accordingly with A1.
I'm trying to apply conditional formatting so that all Fridays will have light grey shading across the row. I can get it to shade every 7th row using the MOD & ROW functions, but the shaded row changes with subsequent months and years (not necessarily Fridays). Can I get it to recognize every Friday through the year.
Disregard the First Table. I cant remove it. refer to the Second Table
This table is a Task Tracker. The Start Button Adds the Current Date in Enercon's Row C1 and the row below (C2) will automaticaly filled with color using Conditional Formating. My Question is how can I code a conditional format for Trail1 Rows. For example when Trail1 Cell is active then you click the start Button instead of Coloring D2 Cell it should Color D3 Cell.
Here is the Code in Start Button
Sub cmdStart_Click() Dim i As Integer Results = MsgBox("Are you working on " & ActiveCell.Value & " today ?", vbOKCancel, "") If Results = vbOK Then
With Sheets("Sheet1") i = .Cells(2, Columns.Count).End(xlToLeft).Column + 1 .Cells(2, i).Value = Now() i = i + 1
End With Else Range("A1").Select End If End Sub Regards, Kevin
I have a table where Sales are in Column B and a % calculation is in Column E. I want to highlight the cells in green that are over 40% and that also meet the criteria where the sale in that row is above $100.
In conditional formatting I tried to use =and(b4>100,e4>40%) but it did not do anything. I am also okay with using a nested if statement.
I want to be able to change the font color of the numbers in a column based on even or odd. I selected the columns and formated them to all be blue... thats the color I want for even, but now I can't figure out how to set a condition that checks for odd numbers and changes them to red. I now have a count of even/odd for all records, and even/odd for the last 30, this provided some very interesting results.
I m creating a sheet in excel where I need to do some conditional formatting but need more than 3 rules so i'm guessing i'll need to use some vb code.
Basically I have a range of cells say from c12 to ag15 These cells all have formulas in linking to other cells in other sheets.
Tha values that will be in them are as follows: s, h, hd,ooo,z and maybe 1 or 2 more will be added later. I need the cells background and text colour both to change to a colour depending on the value in the cell.
eg. cell value = s then background and text colour both to be yellow.