title: Excel VBA copy hyperlink from a cell to a column in a table
body: <p>I would like to copy rows from a source sheet to a target table. Coping the values is no problem. </p>
  
  <p>The column A in the source sheet contains a hyperlink to a website.<br>
  I would like to copy the hyperlink too.</p>
  
  <p>However this code gives an error (type mismatch).</p>
  
  <pre><code>Sub Copy_Hyperlink()
      Dim ActiveSheet As Worksheet
      Dim ActiveTable As ListObject
      Dim Row_Number As Integer
      Dim Last_Row As Integer
      Dim ActiveRow As ListRow
      Dim Hyperlink As Hyperlink
      Set ActiveSheet = Sheets("Sheet2")
      Set ActiveTable = ActiveSheet.ListObjects("Table1")
      Set ActiveSheet = Sheets("Sheet1")    
  
      ActiveSheet.Activate
      Last_Row = ActiveSheet.Cells(Cells.Rows.Count, 1).End(xlUp).Row
  
      For Row_Number = 2 To Last_Row
          Set ActiveRow = ActiveTable.ListRows.Add
          ActiveRow.Range(1, 1).Value = Range("A" &amp; Row_Number).Value
          ActiveRow.Range(1, 2).Value = Range("B" &amp; Row_Number).Value
          ActiveRow.Range(1, 2).Hyperlinks.Add Range _
      ("A" &amp;   Row_Number).Hyperlinks.Item(1).Address
      Next Row_Number
  End Sub
  </code></pre>