本人vba纯小bai,做了个开单表和汇总表,想着开单表填完数据,计算、保存、打印,点保存后怎么在汇总表内之前保存的数据下一行开始保存
图一开单表,右侧三个计算、保存、打印都添加了指定宏,是自己录的。
图二为汇总表,每次点完保存后想自动在下一行开始不知道怎么做
这是我自己录制的三个宏,稍有改动,请DS们帮我看一下需要怎么修改添加什么代码。抱拳!
1、计算重量和金额
Sub 计算()
'
' 计算 宏
'
'
Range("E5").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=
Range("E5").Select
Selection.AutoFill Destination:=Range("E5:E9"), Type:=xlFillDefault
Range("E5:E9").Select
Range("G5").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=
Range("G5").Select
Selection.AutoFill Destination:=Range("G5:G9"), Type:=xlFillDefault
Range("G5:G9").Select
Range("D10").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=
Range("E10").Select
Application.CutCopyMode = False
Range("G9").Select
Selection.Copy
Range("G10").Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("E10").Select
ActiveCell.FormulaR1C1 = "=
Range("G10").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=
Range("B11:G11").Select
End Sub
2、打印,打印后清除开单表内容并且表单号+1
Sub 打印()
ActiveSheet.PrintOut
[h2] = [h2] + 1
Range("A5,B5,C5,D5,A5:G9,G10,E10,D10,D3,B3,F3").Select
Range("F3").Activate
Selection.ClearContents
End Sub
3、保存、将开单表的内容粘贴到汇总表,现在就是每次点完保存不知道怎么能自动跳转下一行开始粘贴,永远的都是覆盖A2-K6
Sub 保存数据()
'
' 保存数据 宏
'
'
Sheets("验收汇总表").Select
Range("A2").Select
ActiveCell.FormulaR1C1 = "=验收开单!R[1]C[1]"
Range("B2").Select
ActiveCell.FormulaR1C1 = "=验收开单!R[1]C[2]"
Range("C2").Select
ActiveCell.FormulaR1C1 = "=验收开单!R[1]C[3]"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=验收开单!R[1]C[4]"
Range("A2:D2").Select
Selection.Copy
Range("A3:D6").Select
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("E2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=验收开单!R[3]C[-4]"
Range("E2").Select
Selection.AutoFill Destination:=Range("E2:K2"), Type:=xlFillDefault
Range("E2:K2").Select
Selection.AutoFill Destination:=Range("E2:K6"), Type:=xlFillDefault
Range("E2:K6").Select
End Sub