title: Excel Data Manipulation using VB.NET using Interop libraries
body: <p>I am newbie to VB.NET and was trying to make a windows form application to copy data from a master excel workbook to a new file using a template.With the code below i am able to create a new file with a template.</p>
  
  <p>What i want to do now is copy data from a master excel file and paste it to the new file i have created based on the range selection using a check box in the windows form.The data is scattered in the master workbook in different sheets and i don't know where to start or how to start. any help or advise will be appreciated.
  For Eg: From the form if i select sheet 1 &amp; sheet 2 the code should copy data from sheet 1 first and below that it should copy data from sheet 2 &amp; so on </p>
  
  <pre><code>Imports Excel = Microsoft.Office.Interop.Excel
  
  Public Class Form1
  
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      Dim xlApp As Excel.Application = New Microsoft.Office.Interop.Excel.Application()
      If xlApp Is Nothing Then
          MessageBox.Show("Excel is not properly installed!!")
          Return
      End If
  
      Dim xlWorkBook As Excel.Workbook
      Dim xlWorkSheet As Excel.Worksheet
      Dim misValue As Object = System.Reflection.Missing.Value
  
      xlWorkBook = xlApp.Workbooks.Add("C:\Source.CSV")
  
  
      xlWorkBook.SaveAs("C:\New.CSV", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue,
       Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue)
      xlWorkBook.Close(True, misValue, misValue)
      xlApp.Quit()
  
      releaseObject(xlWorkSheet)
      releaseObject(xlWorkBook)
      releaseObject(xlApp)
  
      MessageBox.Show("Excel file created , you can find the file C:\New.CSV")
  End Sub
  </code></pre>