返回列表 上一主題 發帖

[發問] EXCEL列印時,是否可印出流水號?

回復 8# howard822
不知道這是不是你要的,試試看

1.加入一張空白的工作表,工作表名稱為"計數"


2.sheet1工作表模組
  1. Private Sub CommandButton1_Click()
  2. With Sheets("計數")
  3.   If Left(.[I1], 6) <> Format(Date, "yymmdd") Then
  4.      For Each Sh In Sheets
  5.        Sh.[I1] = ""
  6.      Next
  7.      .[I1] = Format(Date, "yymmdd") & "-000"
  8.   End If
  9.   x = Val(Right(.[I1], 3))
  10.   If ActiveSheet.[I1] = "" Then
  11.      .[I1] = Format(Date, "yymmdd") & "-" & Format(x + 1, "000")
  12.      ActiveSheet.[I1] = .[I1]
  13.   End If
  14.   ActiveSheet.PrintPreview
  15. End With
  16. End Sub
複製代碼
3.其他工作表都用sheet1去複製(ctrl+左鍵)

4.操作看看

TOP

        靜思自在 : 口說好話、心想好意、身行好事。
返回列表 上一主題