title: Excel VBA Runtime Error 1004 when renaming ActiveSheet
body: <p>I'm at a loss when trying to figure out where this code is tripping up. I am looking to rename the activesheet by using a concat of two ranges on the activesheet and some static text. When only one worksheet is in the workbook, the code works great. As soon as a second worksheet is added, I get a Runtime Error 1004. I'll highlight the line of code where it is breaking. This code currently resides in a normal module.</p>
  
  <pre><code>Option Explicit
  Sub updateName()
      Dim fNumber
      Dim pCheckNumber
      Dim asName As String
      Dim tempASName As String
      Dim worksheetName As Object
  
  If ActiveSheet.Name = "Launch Page" Then Exit Sub
  
  fNumber = ActiveSheet.Range("FlightNumber").Value
  pCheckNumber = ActiveSheet.Range("PerformanceCheckNumber").Value
  
  If fNumber &lt;&gt; "" And pCheckNumber &lt;&gt; "" Then
      tempASName = "Flight " &amp; fNumber &amp; " | Run " &amp; pCheckNumber &amp; " (0.0%)"
      asName = tempASName
      MsgBox ActiveSheet.Name &amp; vbCr &amp; asName
      ActiveSheet.Name = asName
      worksheetName.Caption = asName
  Else
      Exit Sub
  End If
  
  End Sub
  </code></pre>
  
  <p>I'm in the process of adding error checking to ensure that I don't have duplicate sheet names. However, due to the nature of the field names, this will never occur.</p>
  
  <p>I appreciate all of the insights!</p>