Hi I am stumbling with this so ask for your help please.
My spread sheet has dozen or more columns with cells that contain multiple lines of text.
In one column some of these lines of text are colored green and I would like code to hide the lines that are green by coloring them white when necessary, then un-hide by changing them back to green.
I found and adapted this code but it looks at the entire spread sheet instead of just one column and takes forever before crashing.
Change font colour
- Paulod
- Thread is marked as Resolved.
-
-
-
Re: Change font colour
I used column D. Change as needed. My color green index was 50. Change to match your color index. Also, please use code tags when posting VBA.
-
Re: Change font colour
Thanks Alan but it appears to only works in cells where all the text is green. Each of my cells has lines of text that are green and lines of text that are black and I only want to change the lines that are green.
-
-
Re: Change font colour
Hi Alan. Cheers I sort of worked out adding your code for myself but it takes forever as it looks at each character and there are 1000's of them in the column. This is what I have now.
Code
Display MoreSub colorWhite() Dim c As Range Dim lr As Long lr = Range("M" & Rows.Count).End(xlUp).Row Dim rng As Range Set rng = Range("M1:M" & lr) For Each c In rng With c For i = 1 To Len(.value) If .Characters(i, 1).Font.ColorIndex = 50 Then .Characters(i, 1).Font.ColorIndex = 2 End If Next i End With Next c End Sub
-
Re: Change font colour
It is quicker than doing it manually. That's the best I can do for you.
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!