Consulting

Results 1 to 2 of 2

Thread: color uppercase words

  1. #1

    color uppercase words

    Hi all,

    i tried to do a macro that can color Camel Cases words like (UnderGround, FedEx) through all excel cells but i failed becasue i don't want to include text with space between the two words as shown below:

    1.jpg


    Simply, i want to look for all words that have two upper cases characters without space between them and color it like (MyComputer or AppleIphone)


    and to skip words like (My Computer or Apple Iphone) because there is a space between the two words






    is it possible to do??

    thanks in advance

    Ethen



    Cross-Posting: https://www.excelforum.com/excel-pro...ml#post4870363
    Attached Files Attached Files
    Last edited by Ethen5155; 03-24-2018 at 10:54 AM.

  2. #2
    Solved by: xladept

    Sub Ethen() 
    Dim r As Long, S As String, i As Long, c As Long
    For r = 1 To Range("A" & Rows.Count).End(xlUp).Row
    S = Range("A" & r): S = Left(Range("A" & r), InStr(1, S, " ") - 1)
    For i = 1 To Len(S)
    If Mid(S, i, 1) = UCase(Mid(S, i, 1)) Then c = c + 1
    Next if
    If c > 1 Then
    Range("A" & r).Characters(Start:=1, Length:=Len(S)).Font.ColorIndex = 44
    c = 0: End If
    Next r
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •