VBA Insert Multiple Columns


SUBMITTED BY: gamefreak

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

FORMAT: Text only

SIZE: 325 Bytes

HITS: 6711

  1. Sub InsertMultipleColumns()
  2. Dim i As Integer
  3. Dim j As Integer
  4. ActiveCell.EntireColumn.Select
  5. On Error GoTo Last
  6. i = InputBox("Enter number of columns to insert", "Insert Columns")
  7. For j = 1 To i
  8. Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromRightorAbove
  9. Next j
  10. Last:Exit Sub
  11. End Sub

comments powered by Disqus