title: Hyperlinks.add VBA
body: <p>I'm programming in VBA. I want to create hyperlinks using <code>hyperlink.add</code> method of the ActiveSheet object but <em>it doesn't work.</em> </p>
  
  <p>Here is my code:</p>
  
  <pre><code>'set the link
  Dim mainsheet As Worksheet
  Dim ws As Worksheet
  Set mainsheet = ActiveWorkbook.Sheets("Main")
  Set ws = ActiveWorkbook.Sheets(rowNumb + 2)
  
  
  mainsheet.Hyperlinks.Add Anchor:=mainsheet.Range(rowTablecontent + rowNumb, colTablecontent + 3), _
                  Address:="", _
                  SubAddress:=ws.Name &amp; "!A1", _
                  TextToDisplay:="Link"
  </code></pre>
  
  <p><strong>Code description:</strong></p>
  
  <p>I have a Mainsheet, on which I have a Table of Contents and a button for starting the macro. When starting the macro, the program imports 4 Files (each has one sheet and equals one sheet in the mainworkbook. With the information of this 4 files there are about 500 sheets which are going to be generated.
  The point is: now i want to have a table of contents. for each sheet a link in the mainsheet.</p>
  
  <p>Variable:</p>
  
  <ul>
  <li>rowTablecontent --> Row on the top of the content table</li>
  <li>colTablecontent --> Column on the left of the content table</li>
  <li>rowNumb         --> Rowcounter on the inputfile </li>
  </ul>
  
  <p>I used the same code in another program, where it worked, so I don't know what I did wrong.</p>
  
  <p>Does anyone know what could be wrong?</p>
  
  <p><strong>Important Info Copied From Comments</strong></p>
  
  <blockquote>
    <p>In my project I have 4 Input files/sheets. And there it works. But on the autmatically created sheets, it doesn't work.</p>
  </blockquote>