[code
]Private Sub CommandButton1_Click()
On Error Resume Next
If [D6].Value = "kv1" Then
Sheets("T1").Select
Columns("A:I").Select
Selection.EntireColumn.Hidden = False
Range("A221").Select
ActiveSheet.PageSetup.PrintArea = "$A$2:$D$21"
ActiveWindow.SelectedSheets.PrintPreview
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
'Application.Dialogs(xlDialogPrint).Show
'Application.ScreenUpdating = True
Else:
Sheets("T1").Select
Columns("C:G").Select
Selection.EntireColumn.Hidden = True 'an cot C:G
Range("A2:I21").Select
ActiveSheet.PageSetup.PrintArea = "$A$2:$I$21"
ActiveWindow.SelectedSheets.PrintPreview
End If
End Sub
[/code]
file kèm theo tôi không gởi kèm theo trong diễn đàn.
Các bạn tải file theo link: http://sites.google.com/site/anhbatt...viewAsViewer=1
]Private Sub CommandButton1_Click()
On Error Resume Next
If [D6].Value = "kv1" Then
Sheets("T1").Select
Columns("A:I").Select
Selection.EntireColumn.Hidden = False
Range("A221").Select
ActiveSheet.PageSetup.PrintArea = "$A$2:$D$21"
ActiveWindow.SelectedSheets.PrintPreview
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
'Application.Dialogs(xlDialogPrint).Show
'Application.ScreenUpdating = True
Else:
Sheets("T1").Select
Columns("C:G").Select
Selection.EntireColumn.Hidden = True 'an cot C:G
Range("A2:I21").Select
ActiveSheet.PageSetup.PrintArea = "$A$2:$I$21"
ActiveWindow.SelectedSheets.PrintPreview
End If
End Sub
[/code]
file kèm theo tôi không gởi kèm theo trong diễn đàn.
Các bạn tải file theo link: http://sites.google.com/site/anhbatt...viewAsViewer=1