ALOAN
Thành viên chính thức
![](/diendan/data/PhoToDanhHieu/gold.gif)
![](/diendan/data/PhoToDanhHieu/gold.gif)
- Tham gia
- 6/11/07
- Bài viết
- 88
- Được thích
- 29
- Nghề nghiệp
- PURCHASING
Em có code để " In Nhanh" như sau:
Nhưng lại chẳng nhanh hơn chút nào cả.
Mọi người giúp em chỉnh code trên với.
Mã:
Sub InNhanh()
Mã:
[FONT=Times New Roman]Dim i As Integer, iL As Integer, RgnCp As Range, Rgn As Range, Inra[/FONT]
[FONT=Times New Roman]Inra = MsgBox("Nhan Yes de in, Nhan No de xem qua, Nhan Cancel de huy lenh", vbYesNoCancel)[/FONT]
[FONT=Times New Roman]If Inra = vbCancel Then Exit Sub[/FONT]
[FONT=Times New Roman]Application.ScreenUpdating = False[/FONT]
[FONT=Times New Roman]Sheet2.Select[/FONT]
[FONT=Times New Roman]Range("P2").ClearContents[/FONT]
[FONT=Times New Roman]iL = Range("B2").End(xlDown).Row[/FONT]
[FONT=Times New Roman]Set RgnCp = Range("A2:O" & iL)[/FONT]
[FONT=Times New Roman]Set Rgn = Range("N3:N" & iL)[/FONT]
[FONT=Times New Roman]Range("RgnDk").EntireColumn.Hidden = True[/FONT]
[FONT=Times New Roman]For i = 1 To iL - 2[/FONT]
[FONT=Times New Roman]If Rgn(i) <> Range("P2") Then[/FONT]
[FONT=Times New Roman]Range("P2") = Rgn(i)[/FONT]
[FONT=Times New Roman]If Inra = vbYes Then[/FONT]
[FONT=Times New Roman]RgnCp.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("RgnDk"), Unique:=False[/FONT]
[FONT=Times New Roman]ActiveSheet.PrintOut[/FONT]
[FONT=Times New Roman]Else[/FONT]
[FONT=Times New Roman]RgnCp.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("RgnDk"), Unique:=False[/FONT]
[FONT=Times New Roman]ActiveWindow.SelectedSheets.PrintPreview[/FONT]
[FONT=Times New Roman]End If[/FONT]
[FONT=Times New Roman]End If[/FONT]
[FONT=Times New Roman]Next i[/FONT]
[FONT=Times New Roman]ActiveSheet.ShowAllData[/FONT]
[FONT=Times New Roman]Application.ScreenUpdating = True[/FONT]
[FONT=Times New Roman]End Sub[/FONT]
Mọi người giúp em chỉnh code trên với.