|
参与一下。。。。
- Sub 下划线文字转换() '//2024.4.2
- With Sheets("Sheet1")
- For Each cell In .UsedRange
- r1 = 1: r2 = 1
- st = ""
- Do While r1 <= Len(cell.Value)
- If cell.Characters(r1, 1).Font.Underline = xlUnderlineStyleSingle Then
- r2 = r1
- st = st & "(" & Mid(cell.Value, r1, 1)
- Do While cell.Characters(r2 + 1, 1).Font.Underline = xlUnderlineStyleSingle
- r2 = r2 + 1
- st = st & Mid(cell.Value, r2, 1)
- Loop
- st = st & ")"
- r1 = r2 + 1
- Else
- st = st & Mid(cell.Value, r1, 1)
- r1 = r1 + 1
- End If
- Loop
- cell.Value = st
- cell.Font.Underline = False
- Next cell
- End With
- End Sub
复制代码
|
|