Reputation: 1
My code adds one column after each existing column.
I need to add 14 columns. I want this to start by adding the columns after column 2 for each column with data. I believe my current code covers that.
Dim z As Integer
Columns(2).Select
For z = 2 To 20
ActiveCell.EntireColumn.Insert
ActiveCell.Offset(0, 2).Select
Next z
Upvotes: 0
Views: 393
Reputation: 3034
Welcome.... Your code inserts 19 columns.. As you have selected second column First column is inserted between A and B. Now if you want to insert first columns between B and C then Select third column first. and then Z from 4 to 17..Oh you mean 14 columns each time after col B? Then...
Dim z As Integer
Columns(3).Select
For z = 4 To 22
Range(ActiveCell, ActiveCell.Offset(0, 13)).EntireColumn.Insert
'ActiveCell.EntireColumn.Insert
ActiveCell.End(xlToRight).Offset(0, 1).Select
'ActiveCell.Offset(0, 2).Select
Next z
Upvotes: 0