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.
STEP 1: GO TO DEVELOPER> CODE> VISUAL BASIC> COPY/PASTE THE CODE BELOW > CLOSE THE WINDOW
Copy The Code Below;
Dim numColumns As Integer
Dim counter As Integer
‘Select the current column
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
Last: Exit Sub
STEP2. Test it by selecting any cell in which you need to insert rows on then follow
Go to Developer > Code > Macros > Run
Now you are able to insert multiple columns by using macros in Excel.