明確な理由もなく、エラーも発生せずに実行を停止するコードがあります。それはメモリの問題でしょうか?操作しているシートには、多くの書式設定と条件付き書式が含まれる約 1600 行があり、行を挿入するとコードが停止します。停止するコードスニペットは次のとおりです。
With wsBudget
TotalColumn = .Range("TotalColumn").Column
FormulaColumn = .Range("FormulaColumn").Column
If .Cells(lRow, 1).Interior.Color <> 14408946 Then 'OK to insert
cell.EntireRow.Copy
cell.Resize(RowCount, 1).EntireRow.Insert 'It stops after stepping into this line
.Cells(cell.Row - RowCount, 1).EntireRow.ClearContents
.Cells(cell.Row - RowCount - 1, FormulaColumn).Resize(RowCount + 1, 1).FillDown
.Cells(cell.Row - RowCount - 1, TotalColumn).Resize(RowCount + 1, 1).FillDown
.Cells(cell.Row - RowCount - 1, 1).Resize(RowCount, 1).Interior.Color = RGB(255, 255, 255) 'OK to insert or delete
Else
MsgBox "You must select a cell within a table before inserting a row."
Exit Sub
End If
End With