|
1.vba 删除 带删除线的字符型和数值型 ,调试运行正常 ,不完善的地方,耗时,如果数据大;2. 请教下,如何修改以下代码 提高宏的运行速度,非常感谢?
- Sub clear_stikethrough_contents()
- Dim rng As Range, cl As Range
- Dim i As Long
- Dim sts As Worksheet
-
- For Each sts In ThisWorkbook.Sheets
- Set rng = sts.UsedRange ' Get range of sheet
- For Each cl In rng.Cells
- 'numerical variable
- If VarType(cl) = vbDouble And cl.Font.Strikethrough = True Then cl.ClearContents
- 'charater variable
- If VarType(cl) = vbString Then
- For i = Len(cl.Value) To 1 Step -1
- If cl.Characters(i, 1).Font.Strikethrough Then
- cl.Characters(i, 1).Delete
- End If
- Next i
- End If
-
- Next cl
- Next sts
- End Sub
复制代码
|
|