title: Excel: Name sheet tab from cell value in another sheet
body: <p>I can successfully name my sheet tab based on a cell reference in the same sheet with the following VBA code:</p>
  
  <pre><code>Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
      Set Target = Range("A1")
      If Target = "" Then Exit Sub
      On Error GoTo Badname
      ActiveSheet.Name = Left(Target, 31)
      Exit Sub
  Badname:
      MsgBox "Please revise the entry in A1." &amp; Chr(13) _
      &amp; "It appears to contain one or more " &amp; Chr(13) _
      &amp; "illegal characters." &amp; Chr(13)
      Range("A1").Activate
  End Sub
  </code></pre>
  
  <p>However, I am struggling to change the sheet tab based on a cell reference in the title sheet. I have tried simply replacing the range with the reference from the desired sheet, <code>Range("Keywords!A1")</code>, but this does not seem to work.</p>
  
  <p>Any suggestions to get around this would be hugely appreciated.</p>