I have a code as below. First part is to add one empty line (this lags). Next part is an “i” loop where It is adding empty lines based on value of certain cell. This code lags my macro so bad, like 2-3min when I run it. It even crash. The ironic thing is I have 2 subs branch out and when branch 1 run this code it works fine vs when it enters another branch, it lag/crash. Therefore I know the codes work but I’m confused why one sub works fast and one die. Regardless, I’m looking to improve my codes so it doesn’t lag/crash.
Thank you for your help.
Application.CutCopyMode = False
Application.ScreenUpdating = False
Sheets("worksheet1").Select
Range("F2").Select
Selection.Insert
Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Supply = Range("AO189")
Dim i As Integer
Dim numdx As Integer
numdx = Range("t219") + 4
Range("F1").Select
ActiveCell.Offset(Tier + 7).Select
For i = 1 To numdx
Selection.Insert
Shift:=xlDown,
CopyOrigin:=xlFormatFromLeftOrAbove
Next i
LostandAngryatVBA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1