VBA Multiple Rows


SUBMITTED BY: gamefreak

DATE: June 25, 2019, 5:37 p.m.

FORMAT: Text only

SIZE: 439 Bytes

HITS: 6274

  1. #Once you run this macro it will show an input box and you need to enter the number of rows you want to insert.
  2. Sub InsertMultipleRows()
  3. Dim i As Integer
  4. Dim j As Integer
  5. ActiveCell.EntireRow.Select
  6. On Error GoTo Last
  7. i = InputBox("Enter number of columns to insert", "Insert
  8. Columns")
  9. For j = 1 To i
  10. Selection.Insert Shift:=xlToDown,
  11. CopyOrigin:=xlFormatFromRightorAbove
  12. Next j
  13. Last:Exit Sub
  14. End Sub

loading...

comments powered by Disqus