比较行删除的Excel VBA性能问题

时间:2017-09-11 20:26:26

标签: excel vba performance excel-vba

只是想知道为什么列删除需要3秒多的时间来执行行删除?

  

matrixWs

是对称的纸张。如何改进代码?

 If activeRow >= 8 And activeRow < lastRow And deleteRowButton Then

            Debug.Print Now & " start delete normal rows" -->  23:13:53 
            normalWs.Rows(activeRow).EntireRow.Delete

            Debug.Print Now & " lap time before matrix" --> 23:13:53 
            matrixWs.Rows(activeRow).EntireRow.Delete

            Debug.Print Now & " lap time after matrix row" --> 23:13:53 
            matrixWs.Columns(activeRow - 5).EntireColumn.Delete

            Debug.Print Now & " lap time after matrix column" --> 23:13:56

 End If

0 个答案:

没有答案