|
楼主 |
发表于 2012-5-24 15:12
|
显示全部楼层
大神是我的错,我没讲清楚,在点执行的时候,要跳出这个 打印对话框,比如输个3份,就自动递加
我代码发一段,能否帮我改一下: 麻烦大神了!!
Sub BADG()
x1 = "打印对话框"
x2 = "请输入打印张数"
x = Val(InputBox(x2, x1))
ae = Range("d8")
k = 1
ae = Range("d8")
be = Left(ae, 4)
ce = Right(ae, 4)
de = Left(ae, Len(ae) - 4)
fe = Right(de, Len(de) - 4)
ge = Val(fe)
While k <= x
ge = ge + 1
Worksheets("sheet1").PrintOut
If Len(ge) = 1 Then
Range("d8") = Trim(be) + "000" + Trim(Str(ge)) + Trim(ce)
End If
If Len(ge) = 2 Then
Range("d8") = Trim(be) + "00" + Trim(Str(ge)) + Trim(ce)
End If
If Len(ge) = 3 Then
Range("d8") = Trim(be) + "0" + Trim(Str(ge)) + Trim(ce)
End If
If Len(ge) >= 4 Then
Range("d8") = Trim(be) + Trim(Str(ge)) + Trim(ce)
End If
k = k + 1
Wend
End Sub |
|