title: How to use the indirect function in VBA in my code?
body: <p>I need to use the indirect function in VBA. I want to indirect cell C15, or C14 and C15 if possible. </p>
  
  <p>C14 displays the sheet name: Data1
  C15 displays the range: J3:J45999</p>
  
  <p>This should follow the same concept as the indirect function in excel:
  =indirect(C14&amp;"!"&amp;C15)</p>
  
  <pre><code>Private Sub Unique_Click()
  
  Dim xRng As Range
  Dim xLastRow As Long
  Dim xLastRow2 As Long
  Dim I As Integer
  On Error Resume Next
  
  Set xRng = Worksheets("Data1").Range([indirect("c15")]).Select
  If xRng Is Nothing Then Exit Sub
  On Error Resume Next
  xRng.Copy Range("B21")
  xLastRow = xRng.Rows.Count + 1
  ActiveSheet.Range("B21:B" &amp; xLastRow).RemoveDuplicates Columns:=1, Header:=xlNo
  
  
  End Sub
  </code></pre>