我写了一段代码,想实现从excel中提取两部分格式不一样的数据,但是保存的时候报错,不知道是什么问题?
With DataTables("库存明细表")
.DataRows.Clear()
End With
Dim Book As New XLS.Book("E:\Vincent\库存报表\1804\430-财务库存.xlsx")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim nms() As String = {"日期","区域","店铺","店铺名","货号","店铺级别","大类","季节","品牌","月份"}
Dim opq() As Double = {"销售数量","销售金额","吊牌金额","库存数量","库存金额"}
For n As Integer = 1 To Sheet.Rows.Count -1
Dim r As Row = Tables("库存明细表").AddNew()
For m As Integer = 0 To nms.Length - 1
r(nms(m)) = Sheet(n,m).Value
Next
For s As Integer = 0 To opq.length - 1
r(opq(s + 10)) = Sheet(n,s+10).Value
Next
Next