|
代码不作大的改动,可这样改:- Sub 录入数据()
- Application.ScreenUpdating = False
- If Range("J1") = "入库" Then
- x = 1
- Do While Not (IsEmpty(Sheets("入库").Cells(x, 4).Value))
- x = x + 1
- Loop
- '入库单的行数据统计
- n = x
- Z = [c6].End(xlDown).Row
- a = Sheets("单据录入").Range("B:B").Find("合计", LookIn:=xlValues, LOOKAT:=xlWhole, SEARCHORDER:=xlByColumns).Offset(0, 2)
- b = Sheets("单据录入").Range("B:B").Find("合计", LookIn:=xlValues, LOOKAT:=xlWhole, SEARCHORDER:=xlByColumns).Offset(0, 3)
- With Sheets("单据录入")
- ' Do While Not (IsEmpty(.Cells(Z, 3).Value))
- ' Z = Z + 1
- ' Loop
- For k = 7 To Z
- Sheets("入库").Cells(x, 1) = .Cells(5, 8) '日期
- Sheets("入库").Cells(x, 13) = .Cells(7, 11) '基价
- Sheets("入库").Cells(x, 14) = .Cells(7, 12) '仓库
- Sheets("入库").Cells(x, 15) = .Cells(7, 13) '备注
- Sheets("入库").Cells(x, 12) = .Cells(7, 10) '含税
- Sheets("入库").Cells(x, 2) = .Cells(4, 8) '编号
- Sheets("入库").Cells(x, 3) = .Cells(k, 3) '规格
- Sheets("入库").Cells(x, 4) = .Cells(k, 4) '件数
- Sheets("入库").Cells(x, 5) = .Cells(k, 5) '数量
- Sheets("入库").Cells(x, 6) = .Cells(k, 6) '单价
- Sheets("入库").Cells(x, 7) = .Cells(k, 7) '金额
- Sheets("入库").Cells(x, 8) = .Cells(4, 2) '车号
- Sheets("入库").Cells(x, 9) = .Cells(5, 2) '单位
- x = x + 1
- Next k
- End With
- Sheets("入库").Cells(x - 1, 10) = a '单位
- Sheets("入库").Cells(x - 1, 11) = b '单位
- m = x - n
- MsgBox "您已向“入库”中加入了" & m & "条记录,请在“入库”中进行确认!"
- End If
- End Sub
复制代码 |
|