e có đoạn code sau in tự động từng sheet tất cả các file trong 1 thư mục và e đang muốn in bất đầu từ sheet2 đến sheet9 (bỏ sheet1) nhưng không hiểu sao máy cứ in cả sheet1, mọi người giúp em với ạ
	
	
	
		
				
			
		Mã:
		
	
	Private Sub CommandButton1_Click()
Dim MyPath As String, FilesInPath As String
    Dim MyFiles() As String
    Dim SourceWB As Workbook, DestWB As Workbook
    Dim sh As Worksheet
    Dim i As Integer, j As Integer, Z As Integer
    Application.ScreenUpdating = False
    MyPath = ThisWorkbook.Sheets(1).Cells(2, 2)
    FilesInPath = Dir(MyPath & "*.xls*")
    While FilesInPath <> ""
        i = i + 1
        ReDim Preserve MyFiles(1 To i)
        MyFiles(i) = FilesInPath
        FilesInPath = Dir()
    Wend
    For j = 1 To UBound(MyFiles)
        Set SourceWB = Workbooks.Open(MyPath & MyFiles(j))
        For Z = 2 To 9 Step 1
            Set sh = SourceWB.Sheets(Z)
            If sh.Visible <> xlSheetHidden And sh.Index <> 1 Then
                sh.Activate
                sh.PrintOut
            End If
        Next Z
        SourceWB.Close SaveChanges:=False
    Next j
    Application.ScreenUpdating = True
End Sub
	
	
	  

