Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Font.ColorIndex = 5 then . . .
I have a column of data where some of the cells font color is blue and some
is black. I need a macro which looks to see if the font color is blue, then put a certain text string in another column. For example: if cell C45 Font.ColorIndex = 5, then put "Embedded" in cell M45, if not then put "Loose" in cell M45. And so on all the way through the data. My goal is to be able to filter column M for "Embeded" after I run the macro. Can anyone help? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Font.ColorIndex = 5 then . . .
I was unclear as to whether you wanted to search Column C or just what so
this searches the entire used range. If you want just column C I comented out that line. You can just Un-comment it. It adds the word embedded. It does not add the word Loose but if all you want to do is filter then this should work for you... Sub AddFilterField() Dim rngCurrent As Range Dim rngToSearch As Range Dim rngToFill As Range Set rngToFill = ActiveSheet.Range("M1").EntireColumn Set rngToSearch = UsedRange 'Set rngToSearch = Intersect(ActiveSheet.Range("C1").EntireColumn, UsedRange) For Each rngCurrent In rngToSearch If rngCurrent.Font.ColorIndex = 5 Then Intersect(rngCurrent.EntireRow, rngToFill).Value = "Embedded" End If Next rngCurrent End Sub HTH "jeremy nickels" wrote: I have a column of data where some of the cells font color is blue and some is black. I need a macro which looks to see if the font color is blue, then put a certain text string in another column. For example: if cell C45 Font.ColorIndex = 5, then put "Embedded" in cell M45, if not then put "Loose" in cell M45. And so on all the way through the data. My goal is to be able to filter column M for "Embeded" after I run the macro. Can anyone help? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Font.ColorIndex = 5 then . . .
This page shows how to filter by colour
http://www.xldynamic.com/source/xld.ColourCounter.html -- HTH RP (remove nothere from the email address if mailing direct) "jeremy nickels" wrote in message ... I have a column of data where some of the cells font color is blue and some is black. I need a macro which looks to see if the font color is blue, then put a certain text string in another column. For example: if cell C45 Font.ColorIndex = 5, then put "Embedded" in cell M45, if not then put "Loose" in cell M45. And so on all the way through the data. My goal is to be able to filter column M for "Embeded" after I run the macro. Can anyone help? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
DataLabel.Font.ColorIndex vs DataLabel.Text (Private Sub does not work in excel 2003) | Charts and Charting in Excel | |||
colorindex | Excel Discussion (Misc queries) | |||
VBA syntax for Font & Interior ColorIndex | Excel Discussion (Misc queries) | |||
unable to set the colorindex property of the font class | Excel Programming | |||
Font and Fill ColorIndex | Excel Programming |