Foxtable(狐表)用户栏目专家坐堂 → 导入EXCEL表符合条件指定列的值


  共有2747人关注过本帖树形打印复制链接

主题:导入EXCEL表符合条件指定列的值

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110790 积分:563882 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/3/5 21:53:00 [显示全部帖子]


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110790 积分:563882 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/3/5 21:59:00 [显示全部帖子]

Dim Book As New XLS.Book("D:\问题\新建文件夹\采购.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Tables("当月采购").StopRedraw()
Dim nms() As String = {"供应商","单据类型","入库日期","单号","物料编码","货物名称","规格","单位","数量","单价","金额","付款情况"}
For n As Integer = 1 To Sheet.Rows.Count -1
    Dim gys As String = sheet(n,0).Text
    Dim dh As String = sheet(n,3).Text
    Dim bm As String = sheet(n,4).Text
    Dim sl As String = sheet(n,8).Text
    Dim dr As DataRow = DataTables("当月采购").Find("供应商 = '" & gys & "' and 单号='" & dh & "' and 物料编码='" & bm & "' and 数量=" & sl)
    If dr IsNot Nothing Then '如果不存在同编号的订单
        For m As Integer = 0 To nms.Length - 1
            dr(nms(m)) = Sheet(n,m).Value
        Next
    End If
Next
Tables("当月采购").ResumeRedraw()

 回到顶部