Excel 2010 :: Color Fill And Font Reset Macro Routine?
Aug 12, 2012
In Excel 2010, you can color a cell with a fill color and a font color.
It can be done manually via one of 3 methods that I know of (aside from a macro or a routine):
-From the ribbon button (underneath the font size and increase and decrease font size toolbar buttons)
-By formatting the cell (right clicking on a cell),
-Clicking on the ribbon's font section (giving you the same 6 category format cell box as right clicking on a cell)
What I need is a routine that resets the Fill Color and Font Color toolbar buttons to "No Fill" and "Automatic" if I run it inside a macro or create a command button on a worksheet.
My macro works fine but I'm interested in seeing if I can speed it up. What I'm doing is starting at the bottom and comparing it with the row above and if they match in font color it will fill the top with orange and delete the bottom. This works but usually takes several minutes.
Public Sub ADMINCompareList() Dim varTest1, varTest2 Dim lng As Long, i As Integer, iTest As Integer Application. ScreenUpdating = False Worksheets("ADMIN").Activate For lng = ActiveSheet.UsedRange.Rows.Count To 2 Step -1 If Not Range("M" & lng).Font.Color <> Range("M" & lng - 1).Font.Color Then Goto newrow End If varTest1 = Intersect(Range("J:W"), Rows(lng)) varTest2 = Intersect(Range("J:W"), Rows(lng - 1)) For i = 1 To 14....................................
I am looking to implement the "Compare Documents" function (available in Word 2010) in Excel 2010 through VBA programming between different text contained in two cells.
In Word this function works quite well (not perfectly), but it highlights in different ways which part has been deleted and which one has been added between an "original" document and a "revised" one.
For the nature of my job, I need to do this on a daily basis and I used to output text from Excel to Word, then compare the two text, and then copy it back to Excel.
Here comes the problem: since in Word the text is formatted (and what I'm looking for is formatted/highlighted text as output), I can't just paste it in Excel as it is: any editing, merging, splitting done on the pasted text (that eventually I need to do) makes the formatting disappear (above all with VBA functions, that can only output data and can't format it).
In other words: given two cells containing different text, I would like to be able to fill a third cell with text formatted accordingly to the TextDiff output between the two original cell.
E.g.: INPUT: Cells(1,1).Value2 = "my name is Andrea and I like jogging" (original) Cells(1,2).Value2 = "my name is Giovanni and I like running" (revised)
OUTPUT: Cells(1,3) wll contain: "my name is AndreaGiovanni and I like joggingrunning"
Obviously, since UDF doesn't allow formatting of cells, I would need to adjust the main Sub for each pair of document I have to revise, but that won't be the problem: what I need is the engine. It's been two years and a half that I do advanced VBA programming at work but it looks like I can't grasp the rationale behind the LCS algorithm.
I am trying to use VBA in Excel 2007 to change bar chart series colors. I have found a few posts that link it to a cell background, but I'm struggling to find one that does the font color.
It would be great if I could change the bar chart series to match the color of the text in the A column, so that if I highlighted the value in A1 and changed the text color to orange for whatever reason, the chart updates the value of 1.2 to an orange bar (see below).
I am using Excel 2010 and basically i am trying to fill a range of cell with a green color if any value was enter in a specific cells. Example: I would like to fill range: A10:c13 with a green color (regardless of the cells content in this range) if a value was entered in cell C10 or C11 or C12 or C13.
I've tried conditional formatting but unfortunately I'll have to apply formatting for every cell and for a range of over hundred cells is not efficient.
I have written a VBA procedure which loops through excel files in an array: in turn it opens the file, refreshes the data, saves the file and closes. I would like to write an error handler which stores the file which errored (copied from the loop iteration) and the error description to an array. The error handler should then close the file and continue with the next iteration - e.g.
Code: If ActiveWorkbook.ReadOnly Then ActiveWorkbook.Close Next i *Although a generic if error may be better.
My idea is that all files which errored in some way will be stored in an array which I can automatically print/send to a user so they can manually figure out the problem. (This element falls outside the range of this query).
Below is a simple example of my efforts which only contains one file in the array to make things simpler: the error handler section won't work, it's just there to show my thinking
Code: Sub Refresh_CRIS() On Error GoTo Errorhandler Dim routepath As String routepath = " chdfsSharedAreaPrivateTest" ChDir routepath
[Code] ........
Errorhandler: On Error Resume Next Failed = Array(i) If ActiveWorkbook.ReadOnly Then 'Just an example for testing ActiveWorkbook.Close Else MsgBox "Pivots which failed to refresh:" & Failed '& ", ", 0, "Debug" 'Test with msgbox End If End Sub
I have a spreadsheet that i download from the net daily, which is seperated into columns of information.
I want to be able to look down a column and mark a cell in a seperate column if the cell font text is red.
For example looking down column A ... if the font text of a1 is red then mark the cell background colour of T1 red - if a2 text colour is red then mark the cell T2 red .... etc etc.
If the font colour in a1 or a2 ... etc etc is any other colour then do nothing.
I have 5 columns I wish to look down and mark in 5 seperate columns - I have tried to do this by conditional formating but don't know the fomula for checking font colour.
Using Excel 2010 - I have a large workbook with multiple worksheets - been using it succesfully every day for a long time. All of a sudden every empty cell, and any cell not specifically formated in every worksheet has a default cell format of Time. Any new workbook created is OK.. defaults to 'General' - But, if I add a new blank worksheet to this particular workbook it defaults to 'Time' format. How did the default cell format for this workbook become set to 'Time' from 'General' and how do i fix it?
Is there a way to create a macro to color code a cell based on the value in a cell, and then look up a value in a table, then color code it based on where it fits into the table?
I have a table of values for about 30 projects. In column g - there is a CPI value (see bold column)
Example: Project ID Name Program PMT SI ID AC Milestone TCP Level [Code] ......
Here is the table:
I have to color code a cell, base on the CPI and how it fits into the table below. So if the current Milestone is M2 or M3 and the CPI calculated is .14 the cell would be colored RED, if the CPI number is 2.01 for M2-M3 I would want cell to be colored Turquiose. If we were at Milestone M6 and the CPI was 2.01, it would be colored blue. If the CPI was .75 at Milestone M5, it would be colored Green
macro that will change the cell color based on text? I have a list of titles in column B. Everytime the word 'Car' is found in this column, I would like to change the font color in columns C-G to the color white within the same row.
Using excel 2007. In a A table of marks obtained by a student. I want to get the content of the cell be displayed in a bigger font and in a particular color when i point to it. When I point to a cell content the display should be in a color of my choice say green and the font be greater than 20 pixels.
I want to select an automatic colour scheme (font) for an Exel sheet. It has 3 columns with values. If the coloums are A, B & C I want to mark the higher value in red. If B is higher than A, B should be red. Again if C is also higher than B, then C also should be red... like that. Values should be read row-wise. How can I do this using a formula?
I am looking to change the color of my text through a macro, which is fine. But I want to change the color according to a date key. So every time I update my date once a week, a new series is "blacked in". The series has the link already in it, I just need it to change color (to black) every time I update it.
Formatting charts is difficult so I'm trying to find a macro that adds me data labels (in the middle) and color these in white in my active spread sheet as shown in the image.
View image: Example
I was trying recording the macro but it was too many commands, is there a simple way to achieve this?
I have a spreadsheet that contains the 5 digit numbers in the rows and the columns respecstively. I'd like a formular or macro to change font color for each cell. If the combined value of the 5 rows are greater or less than the combined range 87030 and 87200, the 5 cells will be changed to Red. If:.........
I have text of size 14 and 18 mixed in cells in a column. Cells are font size 18 or mixed with both 14 and 18 size text. I need to sort out the text with one column of size 14 and another of 18 only. I am thinking of copying and pasting the column twice and run a macro in first column to remove the text of size 14, and another macro to delete text of size 18 in second column. I need the leftover text to be in same rows.
I tried everywhere and couldn't find a macro for mixed text cells. I am using Microsoft Excel 2010.
I have attached the relevant spreadsheet for which I need to alter the color of the columns based on Site number ( Sheet 1). % Mortality will be represented in the Y-Axis, and the Site numbers would be on the X-Axis. All columns (% Mortality) except one will be of the same color, and the one of a different color will indicate a specific site. As an example, site 86 is colored differently. The way I require the chart to look is shown on Sheet 1.
After reading through some great posts on Ozgrid, I managed to do this using conditional formatting (Sheet 2), but that sort of falls short because I am required to add a data table to the chart, and the parameter that is indicated by the column bars happens to appear twice in the data table.
I was wondering if this can be automated maybe using VBA, but with the possibility of simply matching the color of columns with the font color of respective entry in the data series.
My fill down menu does not pop up once I click and drag down over several cells. I have checked my options, under advanced, and it is checked .
I can use the right click and fill down and THAT menu pops up, but I will want the regular left click menu to pop up as I am accustomed to using it. I am thinking it's a keyboard shortcut that I may have inadvertently clicked to disable it.
I have two columns. The first one (A) contains cells that have different Fill colors. The second column (B) contains text adjacent to the colored cells. I am trying to change the color of the text in the second column (B) to the corresponding color in the adjacent cell in the first column (A). I don't think conditional formating works well in this situation. I believe the solution would be some sort of macro.
I have a workbook in which there is a sheet containing a table.
Excel 2002ABC123Specific Gravity6 Volt ValuesSOC40.0000.000Dead 51.1345.97010%61.1485.99020%71.1626.02030%81.1766.06040%91.1906.10050%101.1976.12055% 111.2046.14060%121.2116.16065%131.2186.18070%141.2256.20075%151.2336.23080%161.2416.26085% 171.2496.31290%181.2576.32095%191.2656.350100%SOC Chart
From another sheet I query this table using the LOOKUP function to obtain values from column C such as 25% 60% and so on. A typical query formula looks like this:
=LOOKUP(B2,'SOC Chart'!B4:'SOC Chart'!C19)
It would be nice if the fill color came along with the value.
I have font color white in blank cells in column E and I (from row 5 to row 245) so the visitors will not see the text. If any of these cells become yellow (color code is 6), the font color will become black so visitors can see the text alot far better than white. I've tried this code myself after this post but nothing happen
Here's a problem I'd like to be able to solve in VBA:
Retrieve the current cell color (let's say A1 = 'green')
Format A1's cell colors (using the VBA equivalent of the 'Format Cells' / 'Fill' / 'Fill Effects' / '2 color Gradient' feature) so that the background cell color (color 2) is set to 'green' with color 1 being set to 'white' with a shading style of "From Center"
I have a udf that returns a string to the cell. The string is made up of multiple string "objects". What I am wondering is if I can set the font color of certain objects so that when the final string is built and returned, the font of those portions is set.
Ex. of simple idea (this is not actually my code, just a way to illustrate. I realize there is no point to this UDF):
VB:
Function StringReturn (Str1 As String, Str2 As String, Str3 As String) As String StringReturn = Str1 & Str2 & Str3 End Function
Now what if I wanted Str1 and Str3 to be blue, and Str2 to be red for example. So that when the UDF calculates it would return: Str1Str2Str3
I need a macro to fill any cell in any column with red color. The same cell should also have red fonts with word 'RED' typed in the cell, so that word 'RED' is invisible.