![]() |
Extracting font color within a range
I have a range (I'm calling it r) that refers to a cell. I've found that
the cell has multiple colorindeces. How do I extract the characters where the color index is RED only. Thanks, Barb Reinhardt |
Extracting font color within a range
This should work:
For Each Character in Range(r).Characters If Font.ColorIndex = 3 Then 'Do Something End If Next "Barb Reinhardt" wrote: I have a range (I'm calling it r) that refers to a cell. I've found that the cell has multiple colorindeces. How do I extract the characters where the color index is RED only. Thanks, Barb Reinhardt |
Extracting font color within a range
Of course, if the r already = Range("?") then it would be r.Characters.
"Barb Reinhardt" wrote: I have a range (I'm calling it r) that refers to a cell. I've found that the cell has multiple colorindeces. How do I extract the characters where the color index is RED only. Thanks, Barb Reinhardt |
Extracting font color within a range
"Barb Reinhardt" wrote: I have a range (I'm calling it r) that refers to a cell. I've found that the cell has multiple colorindeces. How do I extract the characters where the color index is RED only. Thanks, Barb Reinhardt As a function: Function GetRed(rng As Range) As String Dim r As String, i As Long r = "" For i = 1 To Len(rng.Value) If rng.Characters(i, 1).Font.ColorIndex = 3 Then r = r & rng.Characters(i, 1).Text End If Next i GetRed = r End Function Tim |
All times are GMT +1. The time now is 12:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com