2015-04-25 19 views
0

我试图将特定数据从一个工作表导出到多个工作表。使用vb.net将sheet1中的数据导出到多个工作表

我不要求给我整个代码我只是需要一个例子,从

开始,例如:工作表Sheet1有该数据

 value1 4 
     value2 7     this goes to sheet named value 


     type of car Honda  this goes to sheet named car 
     Model   civic 

     category  Exp 
     category2  Wo   this goes to sheet named category 

回答

0

xlWorkBook = xlApp.Workbooks.Open(”。 。\ Desktop \ test.xlsX“)

'~~> Opens Destination Workbook. Change path and filename as applicable 
    ' xlWorkBook2 = xlApp.Workbooks.Open("C:\Tutorial\Book1.xlsx") 

    '~~> Display Excel 
    xlApp.Visible = True 

    '~~> Set the source worksheet 
    xlWorkSheet = xlWorkBook.Sheets("Sheet1") 
    '~~> Set the destination worksheet 
    xlWsheet2 = xlWorkBook.Sheets("Sheet5") 
    '~~> Set the source range 
    xlSourceRange = xlWorkSheet.Range("A1:L8") 
    '~~> Set the destination range 
    xlDestRange = xlWsheet2.Range("A1:E8") 

    '~~> Copy and paste the range 
    xlSourceRange.Copy(xlDestRange) 
相关问题