title: vb.net chart using data from excel
body: <p>I am trying to just do a simple example before I do a more advanced project and I cant figure out how to use excel data from cells in a chart in vb.net. When I look it up online all I can find is database to vb.net or from vb.net to excel chart. Was going off of this for awhile but none of it is working <a href="http://www.siddharthrout.com/2011/10/18/charting-with-vb-net-2010/" rel="nofollow">http://www.siddharthrout.com/2011/10/18/charting-with-vb-net-2010/</a></p>
  
  <p>Then I tried the below code with no luck, Get run time error converting range to string</p>
  
  <pre><code>Imports Excel = Microsoft.Office.Interop.Excel
  Public Class Form1
  Dim appXL As Excel.Application
  Dim wbsXL As Excel.Workbooks
  Dim wbXL As Excel.Workbook
  Dim Rangex As Excel.Range
  Dim Rangey As Excel.Range
  Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      appXL = CreateObject("Excel.Application")
      appXL.Visible = True
      wbsXL = appXL.Workbooks
      wbXL = wbsXL.Open("C:\Users\aholiday\Desktop\Data.xlsx")
  
      Rangey = wbXL.Range("A1:A2")
      Rangex = wbXL.Range("B1:B2")
  
      With chtTest
          .Series("Series1").YValueMembers = Rangey
          .Series("Series1").XValueMember = Rangex
  
      End With
  End Sub
  End Class
  </code></pre>
  
  <p>Can anyone show me a basic example using 2 cells for the x and 2 cells for the y axis data.  </p>