title: VBA Subscript out of range - error 9
body: <p>Can somebody help me with this code, I am getting a <em>subscript out of range</em> error:</p>
  
  <p><img src="https://i.stack.imgur.com/ecO6i.png" alt="enter image description here"></p>
  
  <p>The line after the 'creating the sheets is highlighted in yellow in debugger</p>
  
  <pre><code>'Validation of year
   If TextBox_Year.Value = Format(TextBox_Year.Value, "0000") Then
  
   'Creating Process
  'Creation of new sheet
  Workbooks.Add
  ActiveWorkbook.SaveAs FileName:= _
      "" &amp; Workbooks("Temperature Charts Sheet Creator").Sheets("MENU").Cells(4, 12).Value &amp; "Data Sheet - " &amp; ComboBox_Month.Value &amp; " " &amp; TextBox_Year.Value &amp; ".xls", FileFormat _
      :=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
      False, CreateBackup:=False
  
  'Creating of the sheets
  Windows("Data Sheet - " &amp; ComboBox_Month.Value &amp; " " &amp; TextBox_Year.Value &amp; ".xls").Activate
  
      Sheets("Sheet3").Select
      Sheets("Sheet3").Name = "31 " &amp; ComboBox_Month.Value
      Sheets("Sheet2").Select
      Sheets("Sheet2").Name = "30 " &amp; ComboBox_Month.Value
      Sheets("Sheet1").Select
      Sheets("Sheet1").Name = "29 " &amp; ComboBox_Month.Value
  
  For i = 28 To 1 Step -1
  
      Sheets.Add
      ActiveSheet.Name = i &amp; " " &amp; ComboBox_Month.Value
  
  Next
  </code></pre>