PDA

View Full Version : Return Color of Individual Characters in Cell



Bcavs2007
11-24-2014, 07:06 AM
Hi Everyone,

New here but have been searching around in the threads for a while. I was wondering if someone could help me out with my code. I am trying to write a Macro to return the color of individual characters within a cell. In order to do so I have tried to adapt simple code that returns the color of text in a cell thats worked out for me. Anyways What I have written so far is as follows:


Function GetColor3(Mycell As Range)
GetColor3 = Mycell.Characters(Start:=1, Length:=1).ColorIndex
End Function

The issue I am sure is with the ".Characters" statement, I believe I am using it incorrectly. I have a cell with three characters in it, I want to check only the first character for color, the I can adapt the code later to check only the third.


Thanks for the help

mikerickson
11-24-2014, 07:18 AM
Try

GetColor3 = Mycell.Characters(Start:=1, Length:=1).Font.ColorIndex

Bcavs2007
11-24-2014, 08:35 AM
Thanks for the help!