繁体   English   中英

excel中最后使用的单元格太大,试图删除多余的列和行时excel崩溃

[英]Last used cell in excel is so large excel crashes when trying to delete excess columns and rows

我有一个工作表,其中最后一次使用的单元格称为单元格(1048381,BH)。 我知道我应该删除所有行(和列,但在这种特殊情况下不那么相关,因为实际上使用了BH的所有列),直到最后一行为止,但是最后一行的数量如此之多,以至于表现出色(64-位)崩溃,当我去解决这个问题。 有什么建议吗?

谢谢!

实际上,您不必删除最后一个有效数据行与一个恶意最后一个单元格之间的行。 使用“主页”,“编辑”,“清除”,“全部清除”就足够了,并且计算强度更低。

这是一些代码,可以对流氓填充的单元格执行相同的操作。

Option Explicit

Sub resetRogueRow()

    Dim lr As Long, nr As Long

    With Worksheets("sheet2")

        lr = .Cells.Find(What:="*", _
                         After:=.Cells(1), _
                         LookAt:=xlWhole, _
                         LookIn:=xlFormulas, _
                         SearchOrder:=xlByRows, _
                         SearchDirection:=xlPrevious, _
                         MatchCase:=False).Row
        nr = .Cells.Find(What:="*", _
                         After:=.Cells(lr, 1), _
                         LookAt:=xlWhole, _
                         LookIn:=xlFormulas, _
                         SearchOrder:=xlByRows, _
                         SearchDirection:=xlPrevious, _
                         MatchCase:=False).Row

        .Cells(nr + 1, "A").Resize(lr - nr, 1).EntireColumn.Clear

    End With
End Sub

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM