Stephen_IV
Well-known Member
- Joined
- Mar 17, 2003
- Messages
- 1,168
- Office Version
- 365
- 2019
- Platform
- Windows
Good afternoon,
I am having some issues, I need to color the max value inside the parentheses in column A. The code below is what I am working with but cannot get it right. Any help would be appreciated!
I am having some issues, I need to color the max value inside the parentheses in column A. The code below is what I am working with but cannot get it right. Any help would be appreciated!
VBA Code:
Sub xdoit()
Dim lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Dim r As Range
Set r = Range("A1:A" & lastrow)
For Each xcell In r
If InStr(xcell.Value, "(") > 0 Then
parts = Split(xcell.Value, "(")
For i = 0 To UBound(parts)
v = Val(Replace(parts(i), ")", ""))
If v > 0 Then
xcell.Characters(v, 2).Font.ColorIndex = 3
End If
Next i
End If
Next
End Sub
|