title: Automatically creating worksheets based on a list in excel
body: <p>I am trying to achieve the following. </p>
  
  <p>When I enter a value on 'Master' worksheet in the Range A5:A50, a macro is run which creates a new worksheet with the same name as the value and then copies the template onto the new sheet. </p>
  
  <p>In addition to this I would also like to copy the value adjacent to the value enter on Master worksheet to this new worksheet so it does calculations automatically. </p>
  
  <p>For example I enter '1' in A5 and '2' in B5. I would like to create a new worksheet with name '1', copy the template from 'Template' worksheet and copy the value of B5 on to the new worksheet named '1'. </p>
  
  <p>I have following code but it also tries to copy Template worksheet with macro is run which results in an error because a worksheet with name 'Template' already exists.</p>
  
  <pre><code>Sub CreateAndNameWorksheets()
      Dim c As Range
  
      Application.ScreenUpdating = False
      For Each c In Sheets("Master").Range("A5:A50")
          Sheets("Template").Copy After:=Sheets(Sheets.Count)
          With c
              ActiveSheet.Name = .Value
              .Parent.Hyperlinks.Add Anchor:=c, Address:="", SubAddress:= _
                  "'" &amp; .Text &amp; "'!A1", TextToDisplay:=.Text
          End With
      Next c
      Application.ScreenUpdating = True
   End Sub
  </code></pre>