- Private Sub Clrbtn_Click()
- Range("B3:D3,F3:H3,B4:D4,F4:H4,B5:D5,F5:H5,A7:G13,E16:F16").ClearContents
- ActiveSheet.Cells(3, 2).Activate
- End Sub
- Private Sub Rukubtn_Click()
- Dim RowNum As Integer
- Dim RowNum1 As Integer
- Dim Count As Integer
-
- Application.ScreenUpdating = False
- If Sheets("出库单").Cells(3, 2) <> "" And Sheets("出库单").Cells(14, 6) <> 0 Then
- RowNum1 = Application.WorksheetFunction.CountA(Range("A7:A13")) + 6
- With Sheets("出库明细表")
- For Count = 7 To RowNum1
- If Not IsEmpty(Sheets("出库单").Cells(Count, 1)) Then
- RowNum = Sheets("出库明细表").[D65536].End(xlUp).Row + 1
- .Cells(RowNum, 1) = Sheets("出库单").Cells(3, 2) '出库单号
- .Cells(RowNum, 2) = Sheets("出库单").Cells(3, 6) '出库日期
- .Cells(RowNum, 3) = Sheets("出库单").Cells(4, 2) '购货单位
- .Cells(RowNum, 12) = Sheets("出库单").Cells(14, 6) '合计金额
- .Cells(RowNum, 13) = Sheets("出库单").Cells(16, 5) '已付金额
- .Cells(RowNum, 14) = Sheets("出库单").Cells(16, 2) '应付金额
- .Cells(RowNum, 15) = Sheets("出库单").Cells(4, 6) '业务员
- .Cells(RowNum, 4) = Sheets("出库单").Cells(Count, 1) '商品编码
- .Cells(RowNum, 5) = Sheets("出库单").Cells(Count, 2) '商品名称
- .Cells(RowNum, 6) = Sheets("出库单").Cells(Count, 3) '规格型号
- .Cells(RowNum, 7) = Sheets("出库单").Cells(Count, 4) '类别
- .Cells(RowNum, 8) = Sheets("出库单").Cells(Count, 5) '单位
- .Cells(RowNum, 9) = Sheets("出库单").Cells(Count, 6) '单价
- .Cells(RowNum, 10) = Sheets("出库单").Cells(Count, 7) '数量
- .Cells(RowNum, 11) = Sheets("出库单").Cells(Count, 8) '金额
- '更新库存量
- End If
- Next Count
- On Error Resume Next
- .Range(.Cells(1, -1), .Cells(RowNum - 1, 14)).Borders.LineStyle = xlContinuous
- End With
- Clrbtn_Click
- If ret = vbOK Then
- ActiveSheet.Cells(3, 2).Activate
- Else
- Range("B3:D3,F3:H3,B4:D4,F4:H4,B5:D5,F5:H5,A7:G13,E16:F16").ClearContents
- End If
- End If
- Application.ScreenUpdating = True
- End Sub
复制代码 |