重新设置一下呗:
- Sub geshi()
- On Error Resume Next
- Dim total%, sr(), i, j, k
- Sheet1.Activate
- 'total = ActiveSheet.UsedRange.Rows.Count '最后一行有内容的行号,赋值给total
- total = Cells(Rows.Count, 1).End(xlUp).Row
- 'MsgBox (total)
- For i = 1 To total
- If Cells(i, "a") <> "" Then
- ReDim sr(1 To Len(Cells(i, "a")))
- For j = 1 To Len(Cells(i, "a"))
- sr(j) = Cells(i, "a").Characters(j, 1).Font.Color
- Next
- '把英文逗号改为中文逗号
- Cells(i, "a") = Replace(Cells(i, "a"), ",", ",")
- For j = 1 To Len(Cells(i, "a"))
- Cells(i, "a").Characters(j, 1).Font.Color = sr(j)
- Next
- End If
- Next
- End Sub
复制代码 |