|
家中没有打印机,没测试- Sub 批量打印人员信息表()
- Dim rng As Range, c As Range, i&
- On Error Resume Next
- Set rng = Application.InputBox("请选择需要打印的人员" & vbCrLf & vbCrLf & "可按CTRL键选择不连续的人员", "提示", , Type:=8)
- If rng Is Nothing Then Exit Sub
- If MsgBox("将有" & rng.Count & "条数据被打印,请确定是否打印!", vbYesNo + vbInformation, "系统提示") = vbNo Then Exit Sub
- For i = 2 To Range("c65536").End(xlUp).Row
- If Application.Intersect(Cells(i, 3), rng) Is Nothing Then
- If c Is Nothing Then Set c = Cells(i, 3) Else Set c = Union(c, Cells(i, 3))
- End If
- Next
- If Not c Is Nothing Then
- c.EntireRow.Hidden = True
- ActiveSheet.UsedRange.PrintOut '打印
- c.EntireRow.Hidden = False
- End If
- MsgBox "操作完毕!", vbInformation + vbOKOnly, "提示"
- End Sub
复制代码 |
评分
-
查看全部评分
|