电子表格excel中某一字段前的下划线如何批量取消
2025-12-20 13:23:00
1.excel中某一字段前的下划线如何批量取消
假设要取消的字符为AB,代码如下:
Sub Del_line()
On Error Resume Next
Dim my_Range As Range
For Each my_Range In Worksheets(1).UsedRange
If InStr(1, my_Range.Value, "AB") > 0 Then '搜索的字符为AB,未限定位置。如果限定位置,需要更改条件。如果开始出现=1
my_Range.Characters(Start:=InStr(1, my_Range.Value, "AB"), _
Length:=2).Font.Underline = xlUnderlineStyleNone
'选定单元格做出改动。字符长度为2
End If
Next
End Sub
