Creating a Loop to Run the Code

  • Selecting a folder has files, via the code and want to run the code on each file and then save exit.



  • I think this part is essential to add loop.


    Code
    1. Dim i As Integer
    2. i = 1
    3. Range("A:A").EntireColumn.Insert
    4. With Range("A1:A" & Range("C" & Rows.Count).End(xlUp).Row)
    5. .Cells(i, 1).Value = 1 + 1
    6. .DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=1, Trend:=False
    7. End With
    8. Loop