title: Run-time error '9': Subscript out of range when naming a sheet
body: <p>The following is an Excel Macro that I am trying to debug but I have never worked with these before.</p>
  
  <p>The line <code>Set log = Sheets("Quote Log")</code> is being highlighted in yellow and the error is <code>Sheets("Quote Log")</code> = <em>Subscript out of range</em></p>
  
  <pre><code>Sub Feasibility()
  
      Dim Feasibility As Workbook
      Dim FeasibilitySheet, log As Worksheet
      Dim row, rowSize, x As Integer
      Dim UAI, customer, today, prodNum, name As String
  
      Set log = Sheets("Quote Log")
      Application.ScreenUpdating = False
  
      If checkSelection() Then
  
          row = getSelectionRow()
          rowSize = getSelectionRowSize()
  
          For x = row To rowSize
              Set Feasibility = Workbooks.Open(Environ$("UserProfile") &amp; "\My Documents\" &amp; "QF-010 UMD Team Feasibility R1.xlsx")
              Set FeasibilitySheet = Feasibility.Sheets("Feasibility")
  
              UAI = log.Cells(x, 1)
              customer = log.Cells(x, 2)
              prodNum = log.Cells(x, 5)
              name = log.Cells(x, 6)
              today = log.Cells(x, 17)
  
             FeasibilitySheet.Range("B3") = customer
             FeasibilitySheet.Range("F3") = today
             FeasibilitySheet.Range("C4") = prodNum
             FeasibilitySheet.Range("C5") = name
             FeasibilitySheet.Range("D41") = today
             FeasibilitySheet.Range("D43") = today
             FeasibilitySheet.Range("E45") = today
  
  
              Feasibility.SaveAs Environ$("UserProfile") &amp; "\My Documents\" &amp; _
                   "Feasibility " &amp; prodNum &amp; " " &amp; UAI &amp; ".xls"
  
             Feasibility.Close
  
  
          Next
  
      End If
  
      ''''
  
  
      Application.ScreenUpdating = True
      'RFI
  End Sub
  </code></pre>