|
|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub Find查找删除()
- Dim Start As Double, Finish As Double
- On Error Resume Next
- Start = Timer
- Dim Cell As Range, FirstAddress As String
- With Range("A2:n5000")
- Set Cell = .Find("0", LookAt:=xlWhole)
- If Not Cell Is Nothing Then
- FirstAddress = Cell.Address
- Do
- Cell.Offset(-1, 0).Delete Shift:=xlShiftToLeft
- Cell.Delete Shift:=xlShiftToLeft
- Set Cell = .FindNext(Cell)
- Loop Until Cell Is Nothing Or Cell.Address = FirstAddress
- End If
- End With
- Finish = Timer
- MsgBox "本次运行的时间是" & Finish - Start
- End Sub
复制代码
帮我看一下这个代码为什么不行,只能删除部分。
|
|