title: Visual Basic on Excel: Iterate though a list of rows
body: <p>I have a following code pattern. It's iterating through row 1, 3, and 25. There is no pattern. I was wondering if I can can condense such code where I can store these row numbers in a list and iterate a for loop based on that list. Note that for each row, only a range of columns is considered. </p>
  
  <pre><code>Dim rng As Range, cl As Range
  
  Set rng = ActiveSheet.Range("A3:A10")
  
  For Each cell In rng
      cell.NumberFormat = "ddMMMyyyy"
  Next cell
  
  Set rng = ActiveSheet.Range("C3:C10")
  
  For Each cell In rng
      cell.NumberFormat = "ddMMMyyyy"
  Next cell
  
  Set rng = ActiveSheet.Range("Y3:Y10")
  
  For Each cell In rng
      cell.NumberFormat = "ddMMMyyyy"
  Next cell
  </code></pre>