title: Using VBA in Excel, how do I loop through a column and create new sheets based on cell values?
body: <p>I have a column in sheet 1 containing different values. I'd like to loop thru the column and create new sheets with the sheet name corresponding to the values. Each time I create a sheet, I like to set the new sheet active and do some task on that sheet.</p>
  
  <pre><code> Sub test()
   i = 4 'starting row in sheet 1
  
     While Not IsEmpty(Cells(i, 1))
  
  
      Dim ws As Worksheet
      Set ws = ThisWorkbook.Sheets.Add
      ws.Name = Cells(i, 1).Value
      'do something to new sheet
  
      i = i + 1
   Wend
   End Sub
  </code></pre>
  
  <p>This does not work and the examples I've found online are way too complex for my need. I hope for an easy solution pointing out what I did wrong. thanks</p>