Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataLabel.Font.ColorIndex vs DataLabel.Text (Private Sub does not work in excel 2003) God Itself Charts and Charting in Excel 4 April 22nd 09 03:40 PM
colorindex Nell Fahey Excel Discussion (Misc queries) 3 April 28th 05 07:06 PM
VBA syntax for Font & Interior ColorIndex Dennis Excel Discussion (Misc queries) 1 November 25th 04 07:38 PM
unable to set the colorindex property of the font class steve Excel Programming 3 December 17th 03 02:41 PM
Font and Fill ColorIndex Frank[_19_] Excel Programming 3 October 31st 03 01:52 PM


All times are GMT +1. The time now is 09:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"