title: EXCEL: How do I ignore several header rows while looping through columns to change number format?
body: <p>The code below is working.  It will progress through all columns in the sheet and change the data within it to a number of fixed length based on the number found in the 2nd row.</p>
  
  <p>My issue is that it selects the entire column when doing so.  This is a problem for me since I have 4 header rows that I do not want converted.  </p>
  
  <p>My first thought was to offset/resize a selection and apply changes to all cells, but I'm simply having no luck doing that.</p>
  
  <p>Can anyone modify this code to ignore the first 4 header rows as it progresses through the columns?</p>
  
  <p>Note:  lastCol is a separate function that simply returns an integer value with the number of the last used column on the sheet.</p>
  
  <pre><code>Sub FormatFixedNumber()
  
      Dim i As Long
  
      Application.ScreenUpdating = False
  
      For i = 1 To lastCol 'replace 10 by the index of the last column of your spreadsheet
          With Columns(i)
              .NumberFormat = String(.Cells(2, 1), "0") 'number length is in second row
          End With
      Next i
      Application.ScreenUpdating = True
  
  End Sub
  </code></pre>