Hi, I have a 100+ column spreadsheet. For each column, I have to insert a new column (starting at column "C" to the last column) and fill it with text from the first cell of the column to the right. I use this code to make it work, but I have to copy it 100+ times for each column insert. Is there a way to loop this code?
'-------------------------
Sheets("Cost1").Select
Columns("C:C").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("C2").Select
ActiveCell.FormulaR1C1 = "=LEFT(R1C4,6)"
Selection.AutoFill Destination:=Range("C2:C" & lastrow)
'-------------------------
Thanks for your help.
'-------------------------
Sheets("Cost1").Select
Columns("C:C").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("C2").Select
ActiveCell.FormulaR1C1 = "=LEFT(R1C4,6)"
Selection.AutoFill Destination:=Range("C2:C" & lastrow)
'-------------------------
Thanks for your help.