Ulisses_Carso
New Member
- Joined
- Sep 4, 2020
- Messages
- 39
- Office Version
- 365
- Platform
- Windows
I have a sheet with X column numbers, I need to insert a column between each one and then I need to insert a formula in each new column.
I already made the code to insert these columns, but I'm stuck in the part of inserting the formula.
Note: The formula will reference and fill down with the cell to its left.
I think a loop could do this, but i don't know how to use it, can anyone help me?
I already made the code to insert these columns, but I'm stuck in the part of inserting the formula.
Note: The formula will reference and fill down with the cell to its left.
I think a loop could do this, but i don't know how to use it, can anyone help me?
VBA Code:
Sub InsertBlankColumns()
Dim MyRange As Range
Dim iCounter As Long
Set MyRange = Range("A:AI")
For iCounter = MyRange.Columns.Count To 2 Step -1
MyRange.Columns(iCounter).EntireColumn.Insert
LastRowColumnA = Cells(Rows.Count, 1).End(xlUp).Row
Next iCounter
End Sub