|
用AI写的
Sub HighlightBrackets()
Dim lastRow As Long
Dim i As Long, j As Long
Dim cellText As String
Dim textStart As Long, textEnd As Long
Dim bracketStart As Long, bracketEnd As Long
lastRow = Cells(Rows.Count, "C").End(xlUp).Row
For i = 1 To lastRow
For j = 1 To 3
cellText = Cells(i, j).Value
textStart = 1
textEnd = Len(cellText)
Do While textStart <= textEnd
bracketStart = InStr(textStart, cellText, "{")
If bracketStart = 0 Then Exit Do
bracketEnd = InStr(bracketStart, cellText, "}")
If bracketEnd = 0 Then Exit Do
Cells(i, j).Characters(bracketStart, bracketEnd - bracketStart + 1).Font.Color = RGB(255, 0, 0)
textStart = bracketEnd + 1
Loop
Next j
Next i
End Sub |
评分
-
1
查看全部评分
-
|