• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA to remove RED/GREEN from within cells and change color to blue

Draccy

New Member
Hello,

I'm colorblind. I was hoping someone might write an Excel or Word macro for me that would find any red/green in the spreadsheet including specific words highlighted in cells or bold, and underlineed and replace it with generic blue. This is consistently a problem for me, and I'm put behind the gun because I can't see edits or comments that people put into the either system.

Is this even possible? Could someone help with this?
 
Last edited:
@Draccy
Do You have any sample Excel-file?
Is it really 'good idea' to change all 'red/green/bold/underlined' to blue?
If someone has used 'blue' to same feature ...
and if You need to return/send that file to anybody else...
Anyway, interesting case ...
 
I'm not sure if it's a good idea, but the problem for me is that I can't recognize that there was a change. I see red as black or if I'm lucky gray. In the example attached, I can't see the notations that are made.
 

Attachments

Hi ,

Can you clarify the following ?

1. Is the data already having multiple cities in each cell , when you get it , or have you processed the data so as to have multiple cities in each cell ?

It would have been easier if each cell could have just one city name in it.

2. At present , the data has the following 5 categories of text :
  • Text in black
  • Text in black , with strikethrough
  • Text in red
  • Text in red , with strikethrough
  • Text in blue
Will these be the only categories , or will there be more ?

Do you want that excluding the first category above , all the remaining categories of text should be coloured blue ?

Narayan
 
Draccy,

Here's how I read your problem.
Code:
Sub test()
    Dim r As Range, m As Object
    Application.ScreenUpdating = False
    With CreateObject("VBScript.RegExp")
        .Global = True
        .Pattern = "\S+"
        For Each r In Range("a2", Range("a" & Rows.Count).End(xlUp))
            For Each m In .Execute(r.Value)
                If .test(r.Value) Then
                    With r.Characters(m.firstindex + 1, m.Length).Font
                        If (.Color <> 0) + (.Strikethrough = True) + (.Underline = True) Then
                            .Color = vbBlue
                            .Bold = True
                        End If
                    End With
                End If
            Next
        Next
    End With
    Application.ScreenUpdating = True
End Sub
 

Attachments

Back
Top