Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello~
I need some assistance in writing a macro which could compare each alpha-numeric character in each row of column I & J and hightlight (via font color) the characters of column I which are different, then move to the next row. I need to run the macro on every row until i come to a blank row. Any help greatly appreciated. Thanks in advance, Don |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Are the string lengths the same in both column I and J for each row?
DJS wrote: Hello~ I need some assistance in writing a macro which could compare each alpha-numeric character in each row of column I & J and hightlight (via font color) the characters of column I which are different, then move to the next row. I need to run the macro on every row until i come to a blank row. Any help greatly appreciated. Thanks in advance, Don |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes, they should be 17 alpha-numeric characters.
"stevebriz" wrote: Are the string lengths the same in both column I and J for each row? DJS wrote: Hello~ I need some assistance in writing a macro which could compare each alpha-numeric character in each row of column I & J and hightlight (via font color) the characters of column I which are different, then move to the next row. I need to run the macro on every row until i come to a blank row. Any help greatly appreciated. Thanks in advance, Don |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
DJS,
I don;t think it is possible to color characters with a different color in the same cell. so do you have another option? DJS wrote: Yes, they should be 17 alpha-numeric characters. "stevebriz" wrote: Are the string lengths the same in both column I and J for each row? DJS wrote: Hello~ I need some assistance in writing a macro which could compare each alpha-numeric character in each row of column I & J and hightlight (via font color) the characters of column I which are different, then move to the next row. I need to run the macro on every row until i come to a blank row. Any help greatly appreciated. Thanks in advance, Don |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It's certainly possible to colour individual characters. The
following code will work on I1 and I2 as long as the values are constant strings, not numbers or the results of formulas. Option Explicit Sub HighlightDifferences() Dim r1 As Range, r2 As Range, i As Integer Set r1 = Range("I1") Set r2 = Range("J1") For i = 1 To Len(r1.Value) If Mid(r1.Value, i, 1) = Mid(r2.Value, i, 1) Then r1.Characters(i, 1).Font.ColorIndex = xlAutomatic Else r1.Characters(i, 1).Font.Color = vbRed End If Next End Sub stevebriz wrote: DJS, I don;t think it is possible to color characters with a different color in the same cell. so do you have another option? DJS wrote: Yes, they should be 17 alpha-numeric characters. "stevebriz" wrote: Are the string lengths the same in both column I and J for each row? DJS wrote: Hello~ I need some assistance in writing a macro which could compare each alpha-numeric character in each row of column I & J and hightlight (via font color) the characters of column I which are different, then move to the next row. I need to run the macro on every row until i come to a blank row. Any help greatly appreciated. Thanks in advance, Don |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is great to know Andrew...thankyou for making me aware of this
|
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Andrew, I just added an "For Each, Next" loop to carry me through all
valid rows & a count of incorrect characters in an adjoining column and it works great. Much Appreciated! "Andrew Taylor" wrote: It's certainly possible to colour individual characters. The following code will work on I1 and I2 as long as the values are constant strings, not numbers or the results of formulas. Option Explicit Sub HighlightDifferences() Dim r1 As Range, r2 As Range, i As Integer Set r1 = Range("I1") Set r2 = Range("J1") For i = 1 To Len(r1.Value) If Mid(r1.Value, i, 1) = Mid(r2.Value, i, 1) Then r1.Characters(i, 1).Font.ColorIndex = xlAutomatic Else r1.Characters(i, 1).Font.Color = vbRed End If Next End Sub stevebriz wrote: DJS, I don;t think it is possible to color characters with a different color in the same cell. so do you have another option? DJS wrote: Yes, they should be 17 alpha-numeric characters. "stevebriz" wrote: Are the string lengths the same in both column I and J for each row? DJS wrote: Hello~ I need some assistance in writing a macro which could compare each alpha-numeric character in each row of column I & J and hightlight (via font color) the characters of column I which are different, then move to the next row. I need to run the macro on every row until i come to a blank row. Any help greatly appreciated. Thanks in advance, Don |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need Help: highlight all the same strings in one cell | Excel Worksheet Functions | |||
Compare two strings | Excel Worksheet Functions | |||
Compare strings in cells and highlight difference | Excel Programming | |||
characters and strings | Excel Discussion (Misc queries) | |||
Compare cells/columns and highlight matching text strings | Excel Worksheet Functions |