标题: [问题求助] vbs wps表格批量打印 如下 [打印本页]
作者: rellymore 时间: 2023-11-23 13:25 标题: vbs wps表格批量打印 如下
Range("A69").Select
Selection.Copy
Sheets("工程筛选").Activate
ActiveSheet.Paste
Sheets("10工程开工报审表 (2)").Activate
Application.EnableEvents = False
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=2147483647, Copies:=1, Preview:=False, ActivePrinter:="RICOH MP 3055 PCL 6_1", PrintToFile:=False, Collate:=False, IgnorePrintAreas:=False
Application.EnableEvents = True
Sheets("工程汇总").Activate
Range("A70").Select
Selection.Copy
Sheets("工程筛选").Activate
ActiveSheet.Paste
Sheets("10工程开工报审表 (2)").Activate
Application.EnableEvents = False
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=2147483647, Copies:=1, Preview:=False, ActivePrinter:="RICOH MP 3055 PCL 6_1", PrintToFile:=False, Collate:=False, IgnorePrintAreas:=False
Application.EnableEvents = True
Sheets("工程汇总").Activate
Range("A71").Select
End Sub
这个只能一条一条的打印
以上Range("A69").Select
Selection.Copy就是复制的YCSY2302JG-018 复制A69到"工程筛选"然后打印"10工程开工报审表 (2)"
Range("A70").Select就是YCSY2304CB-059(我是想批量处理 复制A69到"工程筛选"然后打印"10工程开工报审表 (2)" 之后 继续进行复制A70到"工程筛选"然后打印"10工程开工报审表 (2)" 一直向下逐个处理直到空白单元格)
以下是表格中的顺序
YCSY2302JG-018
YCSY2304CB-059
YCSY2301CB-018
YCSY2302JG-016
YCSY2302JG-015
YCSY2304CB-016
YCSY2304CB-035
YCSY2301CB-019
YCSY2304CB-032
YCSY2304CB-036
YCSY2304CB-051
YCSY2305JG-026
YCSY2304CB-020
YCSY2301CB-002
YCSY2301CB-020
YCSY2301CB-021
YCSY2304CB-021
YCSY2304CB-001
YCSY2305JG-004
YCSY2304CB-029
YCSY2304CB-034
YCSY2304CB-050
YCSY2304CB-066
YCSY2301CB-045
YCSY2305JG-008
YCSY2304CB-068
YCSY2301CB-022
YCSY2301CB-024
YCSY2301CB-023
YCSY2304CB-026
YCSY2304CB-023
YCSY2304CB-009
YCSY2304CB-006
YCSY2304CB-027
YCSY2301CB-043
YCSY2301CB-025
1810A523002M
1810A523002N
1810A523000A
作者: buyiyang 时间: 2023-11-23 22:30
写个循环即可- Sub CopyAndPrintCells()
- Dim wsFilter, wsPrint, wsSour As Worksheet
- Dim cell As Range
-
- Set wsFilter = ThisWorkbook.Sheets("工程筛选")
- Set wsPrint = ThisWorkbook.Sheets("10工程开工报审表 (2)")
- Set wsSour = ThisWorkbook.Sheets("工程汇总")
-
- For Each cell In wsSour.Range("A69:A" & wsSour.Cells(wsFilter.Rows.Count, 1).End(xlUp).Row)
- wsSour.Range(cell.Address).Copy
- wsFilter.Range(cell.Address).PasteSpecial xlPasteAll
- wsPrint.Activate
- Application.EnableEvents = False
- ActiveWindow.SelectedSheets.PrintOut From:=1, To:=2147483647, Copies:=1, Preview:=False, ActivePrinter:="RICOH MP 3055 PCL 6_1", PrintToFile:=False, Collate:=False, IgnorePrintAreas:=False
- Application.EnableEvents = True
- Application.CutCopyMode = False
- Next cell
- End Sub
复制代码
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |