|
楼主 |
发表于 2024-2-4 09:03
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
大家看看我这个方法怎么样:
Sub DelRow1()
Dim Myr&, Myc&, i&, s, r&, c&, ar
With ThisDocument.Tables(1)
Myr = .Rows.Count
ReDim ar(1 To Myr, 1 To 2)
For i = 1 To .Range.Cells.Count
s = .Range.Cells(i).Range.Text
r = .Range.Cells(i).RowIndex
c = .Range.Cells(i).ColumnIndex
If Len(s) > 2 Then
ar(r, 1) = 1
End If
ar(r, 2) = c
Next i
For i = Myr To 1 Step -1
If ar(i, 1) = "" Then
.cell(i, ar(i, 2)).Select
With Selection
.End = .Start
.Cells.Delete 2
End With
End If
Next i
End With
End Sub |
评分
-
1
查看全部评分
-
|