Insert Multiple Columns Using Macros

Have you ever tried to insert multiple columns only by typing in a number? This will be possible by using Macros in your Excel. 

How it works: it will ask you for a number of columns and then inserts it to the right of your selected cell.

Before following the procedure of this tutorial make sure you have enabled the Excel’s Developer Tab.

Previously: How to Use Macros in Excel to Insert Multiple Rows

STEP 1: GO TO DEVELOPER> CODE> VISUAL BASIC> COPY/PASTE THE CODE BELOW > CLOSE THE WINDOW

Copy The Code Below;

Sub InsertMultipleColumns()

Dim numColumns As Integer
Dim counter As Integer

‘Select the current column
ActiveCell.EntireColumn.Select
On Error GoTo Last
numColumns = InputBox(“Enter number of columns to insert”, “Insert Columns”)

‘Keep on insert columns until we reach the desired number
For counter = 1 To numColumns
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromRightorAbove
Next counter
Last: Exit Sub
End Sub

Insert Multiple Columns

STEP2. Test it by selecting any cell in which you need to insert rows on then follow

Go to Developer > Code > Macros > Run

Insert Multiple Columns
Here we need to insert 4 Columns. So we will Type in 4.

Now you are able to insert multiple columns by using macros in Excel.

Insert Multiple Columns