1

I am using following code and it is taking forever to complete-

For i = 1 To 21408
    Range("abcd").Copy
    Rows(Range("abcd").Offset(i, 0).Row).Insert Shift:=xlDown
    Application.CutCopyMode = False
Next i

abcd is Named Range having 8 fields.

Can someone please suggest a way to optimize this code or re-write in a way to achieve the same output?

Thanks

1 Answer 1

3

This does the same thing, much faster:

With Range("abcd")
    .Copy
    .Offset(1).Resize(21408, .Columns.Count).Insert Shift:=xlDown
    Application.CutCopyMode = False
End With
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.