title: Excel VBA Hyperlinked Macros
body: <p>I have a workbook with the first sheet being a "template" sheet that I make a copy of before entering all of the data.  This first template sheet has a hyperlinked macro that works fine if I'm entering date into the template sheet, but when I make a copy and use the hyperlink, it jumps back to the template sheet and runs from there.</p>
  
  <p>Here is the code I'm using, which is written in the Sheet1 Objects area (rather than a module), which might be where I'm going wrong but the hyperlink doesn't seem to work if written in the ThisWorkbook Objects area. </p>
  
  <pre><code>Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
  
      If Target.Range.Address = "$U$5" Then
          Dim MyDir
          MyDir = Range("T5").Value
          Select Case MyDir
              Case "N":
                  Range("B3:E3,C10,C16:D16,H3:K3,I10,I16:J16,N3:Q3,O10,O16:P16").Select
                  Range("B3").Activate
              Case "S":
                  Range("B4:E4,C11,C19:D19,H4:K4,I11,I19:J19,N4:Q4,O11,O19:P19").Select
                  Range("B4").Activate
              Case "E":
                  Range("B5:E5,C12,C22:D22,H5:K5,I12,I22:J22,N5:Q5,O12,O22:P22").Select
                  Range("B5").Activate
              Case "W":
                  Range("B6:E6,C13,C25:D25,H6:K6,I13,I25:J25,N6:Q6,O13,O25:P25").Select
                  Range("B6").Activate
              Case Else
                  MsgBox "No Direction Entered"
          End Select
      End If
  End Sub
  </code></pre>
  
  <p>I don't want to use buttons or Activex/Forms buttons and need it to be a hyperlink (as once I enter the data I need, that copied sheet then itself gets copied into another workbook, which would copy any buttons or controls with it and I don't want to have to remember to delete them every time I finish a form).</p>
  
  <p>Is there any way to have the copied hyperlinked macro work in the copied sheet without having it go back to the original Template sheet?</p>