Change font colour

  • 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.



  • 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


    Misunderstood your needs. Using your code, change this line


    Code
    1. For Each c In ActiveSheet.UsedRange


    to the following


    Code
    1. Dim lr As long
    2. lr = Range("D" & Rows.Count).End(xlUp).Row
    3. Dim rng As Range
    4. Set rng = Range("D1:D" & lr)
    5. For Each c In rng


    again changing the column as needed

  • 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.