按模板批量生成工作表,前提一个模板,然后用代码遍历循环填写人名,再保存为副本,即可达到效果
按模板批量生成工作表代码
Sub 批量生成员工表()
last = Sheet73.Range("C65535").End(xlUp).Row '普通区域
arr = Sheet73.Range("C7:C" & last)
For i = 1 To UBound(arr)
ext = 0
For Each sht In Sheets
If sht.Name = arr(i, 1) Then
ext = 1
End If
Next
If ext = 0 Then
' 复制工作表
Sheet1.Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
'Set newsht = Sheets.Add(After:=Sheets(Sheets.Count))
'Sheet1.Cells.Copy newsht.Cells
ActiveSheet.Cells(1, 1) = arr(i, 1)
ActiveSheet.Name = arr(i, 1)
End If
Next
End Sub
Sub 批量打印()
Dim sht As Worksheet
For Each sht In Sheets
If sht.Name <> "工作表" And sht.Name <> "查询模板" Then
sht.PrintOut
End If
Next
End Sub