(Solved) – Insert Multiple Rows in Excel- Macro Running very slow

  • by
(solved)-–-insert-multiple-rows-in-excel-macro-running-very-slow

Hi Some one please help me to correct the below VBA.

The VBA is working fine but its taking more time to insert rows. i am normally insert more than 500 line items, its updating one by one and taking more time. kindly help to speed up the macro.

Sub InsertMultipleRows()

Dim numRows As Integer
Dim counter As Integer

'Select the current row
ActiveSheet.Unprotect
Range("C23").Select
  ActiveCell.EntireRow.Select
On Error GoTo Last
numRows = InputBox("Enter number of rows to insert", "Insert Rows")

'Keep on inserting rows until we reach the desired number
For counter = 1 To numRows
Selection.Insert Shift:=xlToDown, CopyOrigin:=xlFormatFromRightorAbove
Next counter
Last: Exit Sub
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *