1、建立固定资产明细表
2、设置标准模板,此处选择一张A4纸打印8个标签,调试好页边距
3、插入VB代码
4、插入模块代码Sub pldy()Dim a As IntegerDim b As IntegerDim K As Integera = InputBox("请输入开始打印序号")b = InputBox("请输入结束打印序号")For i = a To bL = (((i - ((i + 1) Mod 2)) Mod 8) \ 2) * 7 + 2If i Mod 2 = 0 ThenK = 5ElseK = 2End IfSheets("标签打印").Cells(L, K) = Sheets("资产明细").Range("d" & i + 1)Sheets("标签打印").Cells(L + 1, K) = Sheets("资产明细").Range("b" & i + 1)Sheets("标签打印").Cells(L + 2, K) = Sheets("资产明细").Range("i" & i + 1)Sheets("标签打印").Cells(L + 3, K) = Sheets("资产明细").Range("k" & i + 1)Sheets("标签打印").Cells(L + 4, K) = Sheets("资产明细").Range("g" & i + 1)If Int(i / 8) = (i / 8) ThenActiveSheet.PrintOutEnd IfNext iEnd Sub此处引用明细表的D,B,I,K,G五列,可根据需要修改代码
5、插入 命令按钮
6、点击命令按钮,输入开始结束序号自动打印