title: VBA - Create Array from Named Range
body: <p>I am ultimately trying to export certain sheets in my excel workbook as pdf's.</p>
  
  <p>I have all the names of the sheets I want to export in a named range (in a column). As an example I have "Total" in A1 and "Total (P)" in A2 on the "Data_Mappings" tab. And these two cells have a named range of "Incurred_Graphs".</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>Dim wb As Workbook
  Dim TabsArray() As Variant
  
  fp = "C:\Users\chris\Documents\Testing\Graphs\Graphs.pdf"
  Set wb = ActiveWorkbook
  
  
  TabsArray = Worksheets("Data_Mappings").Range("Incurred_Graphs")
  
  'TabsArray = Array("Total", "Total (P)")
  
  wb.Sheets(TabsArray).Select
  
  ActiveSheet.ExportAsFixedFormat _
      Type:=xlTypePDF, _
      Filename:=fp, _
      Quality:=x1QualityStandad, _
      IncludeDocProperties:=True, _
      IgnorePrintAreas:=False, _
      OpenAfterPublish:=False
  </code></pre>
  
  <p>I get a type mismatch on the "TabsArray =" line.</p>
  
  <p>If I change the tabs array to commented out line, everything will work, and I will get my pdf of those 2 tabs.</p>
  
  <p>I eventually would like to pick the named range to use in the array based on a single cell from another sheet. Where the user has a dropdown and can pick for example, "Incurred Graphs" or "Paid Graphs". But I want to get this first part down without having to hardcode in all the names of the sheets into VBA.</p>
  
  <p>Thanks!</p>