以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]合并excel数据 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=187697) |
-- 作者:lgj716330 -- 发布时间:2023/8/4 20:44:00 -- [求助]合并excel数据 Dim dtb As New DataTableBuilder("统计") dtb.AddDef("二月", GetType(Double)) dtb.AddDef("三月", GetType(Double)) dtb.AddDef("四月", GetType(Double)) dtb.AddDef("五月", GetType(Double)) dtb.AddDef("六月", GetType(Double)) dtb.AddDef("七月", GetType(Double)) dtb.AddDef("八月", GetType(Double)) dtb.AddDef("九月", GetType(Double)) dtb.AddDef("十月", GetType(Double)) dtb.AddDef("十一月", GetType(Double)) dtb.AddDef("十二月", GetType(Double)) dtb.AddDef("一月", GetType(Double)) dtb.AddDef("合计", GetType(Double)) dtb.AddDef("编号", GetType(String), 32) dtb.Build() Dim Book As New XLS.Book(ProjectPath & "Attachments\\目标.xlsx") Dim Sheet As XLS.Sheet = Book.Sheets(0) Tables("统计").StopRedraw() Dim nms() As String = {"二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月", "一月", "合计", "编号"} For n As Integer = 2 To 15 Dim r As Row = Tables("统计").AddNew() For m As Integer = 0 To nms.Length - 1 For m2 As Integer = 6 To nms.Length - 1 r(nms(m)) = Sheet(n, m2).Value \'目标表是从第七列开始 Next Next Next Tables("统计").ResumeRedraw() 结果每一列都取了目标表第14列的数据 不知哪里问题 [此贴子已经被作者于2023/8/4 20:54:45编辑过]
|
-- 作者:有点蓝 -- 发布时间:2023/8/5 8:40:00 -- For n As Integer = 2 To 15 Dim r As Row = Tables("统计").AddNew() For m As Integer = 0 To nms.Length - 1 r(nms(m)) = Sheet(n, m + 6).Value \'目标表是从第七列开始 Next Next
|