尝试执行此宏时出现上述错误。我对宏和编码一般还是很陌生,所以请原谅。谢谢Sub DeleteEmptyRows()Dim oTable As Table, oRow As Row, _TextInRow As Boolean, i As LongApplication.ScreenUpdating = FalseFor Each oTable In ActiveDocument.Tables For Each oRow In oTable.Rows TextInRow = False For i = 2 To oRow.Cells.Count If Len(oRow.Cells(i).Range.Text) > 2 Then 'end of cell marker is actually 2 characters TextInRow = True Exit For End If Next If TextInRow = False Then oRow.Delete End If NextNextApplication.ScreenUpdating = TrueEnd Sub
3 回答
www说
TA贡献1775条经验 获得超8个赞
我参加聚会迟到了。尝试按以下方式进行替换,我的工作正常-从“ DOMDocument”到“ MSXML2.DOMDocument60”“ XMLHTTP”到“ MSXML2.XMLHTTP60”
慕标5832272
TA贡献1966条经验 获得超4个赞
Sub DeleteEmptyRows()
Worksheets("YourSheetName").Activate
On Error Resume Next
Columns("A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
以下代码将删除工作表(YourSheetName)上列A的内容为空白的所有行。
编辑:未定义的用户定义的类型是由“ oTable作为表”和“ oRow作为行”引起的。将“表和行”替换为“对象”以解决错误并进行编译。
添加回答
举报
0/150
提交
取消