title: Excel Macro find last column used, insert new column and copy formulas from previous
body: <p>I am trying to create an "Insert Column" macro in Excel.</p>
  
  <p>The workbook uses formulas and conditional formatting to display progress along a timeline.  I need to provide users with a way to add additional columns to the timeline.</p>
  
  <p>The macro I am trying to build locates the last column and copies the entirety of column lastColumn into column newColumn.  However, everything that I find online and try to adapt either gives me an object error or doesn't do anything.  Please help me figure out how to do this.</p>
  
  <p>Here's my code so far.  </p>
  
  <pre><code>Sub InsertColumn()
  
      Dim lastColumn As Long
      Dim newColumn As Long
  
      With ActiveSheet
          lastColumn = .Range("A1").SpecialCells(xlCellTypeLastCell).column
      End With
  
      newColumn = lastColumn + 1
  
      Selection.AutoFill Destination:=Columns(lastColumn &amp; ":" &amp; newColumn), Type:=xlFillDefault
  
  End Sub
  </code></pre>