VBA, which can colour A, B, C, D and E separated by vertical bar

Kishan

Well-known Member
Joined
Mar 15, 2011
Messages
1,648
Office Version
  1. 2010
Platform
  1. Windows
Using Excel 2000</SPAN></SPAN>

I got data in the column C (A, B, C, D and E) separated by vertical bar and there is a one space between vertical bar also that I want to coloured all different colour but each alphabet must be the same colour in the below example there are coloured only row 5 & 6 but I need to coloured as long as data are find in the column C
</SPAN></SPAN>


Book1
ABCDE
1
2
3
4P1
5[/COLOR][COLOR=#0000cd]B[/COLOR][COLOR=#000000] | [/COLOR][COLOR=#006400]C [/COLOR][COLOR=#000000]| [/COLOR][COLOR=#800000]D[/COLOR][COLOR=#000000] | [/COLOR][COLOR=#800000]D[/COLOR][COLOR=#000000] | [/COLOR][COLOR=#4b0082]E[/COLOR][/B][COLOR=#000000]
6[/COLOR][COLOR=#ff0000]A[/COLOR][/B][COLOR=#000000] | [/COLOR][COLOR=#0000cd]B[/COLOR][COLOR=#000000] | [/COLOR][COLOR=#800000]D[/COLOR][COLOR=#000000] | [/COLOR][COLOR=#4b0082]E[/COLOR][COLOR=#000000] | [/COLOR][COLOR=#4b0082]E[/COLOR][COLOR=#000000]
7B | B | B | D | D
8A | A | D | D | D
9B | C | C | E | E
10D | D | D | E | E
11A | A | A | C | E
12A | B | C | C | D
13A | A | A | B | C
14B | B | C | D | D
15A | A | C | E | E
16A | A | B | C | C
17B | B | C | D | D
18A | A | C | D | D
19B | C | D | D | E
20A | B | D | E | E
21A | B | D | E | E
22A | A | A | A | E
23A | C | C | D | E
24A | C | C | D | D
25A | C | C | C | D
26A | A | B | B | E
27C | C | D | D | E
28A | A | C | D | D
29A | A | B | D | E
30A | B | C | D | E
31B | C | E | E | E
32A | A | A | C | D
33A | B | C | C | E
34A | B | B | B | D
35A | C | D | D | D
36B | B | C | D | E
37C | C | C | E | E
38B | B | C | E | E
39A | A | B | B | E
40B | C | C | D | E
41A | A | C | C | D
42
43
44
45
46
Sheet16


Thank you in advance
</SPAN></SPAN>

Regards
</SPAN></SPAN>,</SPAN>
Kishan
</SPAN></SPAN>
 
Last edited:
If you are interested, here is my code modified for your formatted 2-digit numbers...
Code:
[TABLE="width: 500"]
<TBODY>[TR]
[TD]Sub ColorLetters()
  Dim R As Long, C As Long, Colors As Variant
  ' Numbers are the font colors for the numbers 01, 02, 03, 04 and 05 in that order
  Colors = Array(255, 13434880, 25600, 128, 8519755)
  For R = 5 To Cells(Rows.Count, "C").End(xlUp).Row
    For C = 1 To 22 Step 5
      Cells(R, "C").Characters(C, 2).Font.Color = Colors(Cells(R, "C").Characters(C, 2).Text - 1)
    Next
  Next
End Sub
[/TD]
[/TR]
</TBODY>[/TABLE]
Rick Rothstein, perfect! I appreciate your help for taking a look into this request also. </SPAN></SPAN>

Thank you for your help
</SPAN></SPAN>

Kind Regards,
</SPAN></SPAN>
Kishan :)
</SPAN></SPAN>

 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
For those looking for a method of handling this with no coding knowledge, the Nutilities add-in has a nutility for this.


It can be downloaded here: http://www.iwishexcel.com/

Once installed, hit Ctrl+Alt+Shift+Enter within Excel to bring up the instructions and then checkout the Cell Multi-Font Color nutility on the Formatting/View tab.
Or you can hit
Ctrl+Alt+Shift+i to get straight to the nutility.


AUJNXKC

This a pic of what the directions look lkike once oyu have it installed in excel.
AUJNXKC

tKcvZjg

https://imgur.com/AUJNXKC
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top