title: Excel 2007 macro fills to end of first sheet for all sheets in workbook
body: <p>The code below creates a new column (A), gives the it the header "Class" and then fills column A with the worksheet name until the last row of B for all worksheets in workbook.  It is working except that it fills all worksheets to the the last row of B from the first sheet processed for all subsequent sheets.  What have I done wrong? I like the fill to be determined by the last row of B for each sheet.</p>
  
  <pre><code>Option Explicit
  
  Sub AddColumnFill()
  
  Dim sht As Worksheet
  
  For Each sht In ActiveWorkbook.Worksheets
  
      sht.Range("A1").EntireColumn.Insert xlShiftToRight
      sht.Cells(1, 1) = "Class"
      sht.Range("A2:A" &amp; Cells(Rows.Count, "B").End(xlUp).Row).Value = sht.Name
  
  Next sht
  
  End Sub
  </code></pre>