Em muốn in 1 lúc 2 sheet, 1sheet in cố định, sheet còn lại in phụ thuộc theo điều kiện của 1 ô trong sheet in cố định. Em viêt code nhưng không biết sai ở đâu, mong các cao nhân chỉ giúp em ạ
Sub inbbnt()
Dim Wya As Worksheet, Wyb As Worksheet, Wyc As Worksheet, Wyd As Worksheet, Wye As Worksheet, Wyf As Worksheet, Wyg As Worksheet, Wyh As Worksheet, Wyi As Worksheet, i As Long
Set Wya = Sheet2
Set Wyb = Sheet1
Set Wyc = Sheet5
Set Wyd = Sheet7
Set Wye = Sheet10
Set Wyf = Sheet11
Set Wyg = Sheet12
Set Wyh = Sheet18
Set Wyi = Sheet19
Sheet2.Select
If Range("Q9").Value = 1 Then Wyb.PrintOut
ElseIf Range("Q9").Value = 2 Then Wyc.PrintOut
ElseIf Range("Q9").Value = 3 Then Wyd.PrintOut
ElseIf Range("Q9").Value = 4 Then Wye.PrintOut
ElseIf Range("Q9").Value = 5 Then Wyf.PrintOut
ElseIf Range("Q9").Value = 6 Then Wyg.PrintOut
ElseIf Range("Q9").Value = 7 Then Wyh.PrintOut
Else
Wyi.PrintOut
End If
Next
Sub inbbnt()
Dim Wya As Worksheet, Wyb As Worksheet, Wyc As Worksheet, Wyd As Worksheet, Wye As Worksheet, Wyf As Worksheet, Wyg As Worksheet, Wyh As Worksheet, Wyi As Worksheet, i As Long
Set Wya = Sheet2
Set Wyb = Sheet1
Set Wyc = Sheet5
Set Wyd = Sheet7
Set Wye = Sheet10
Set Wyf = Sheet11
Set Wyg = Sheet12
Set Wyh = Sheet18
Set Wyi = Sheet19
Sheet2.Select
If Range("Q9").Value = 1 Then Wyb.PrintOut
ElseIf Range("Q9").Value = 2 Then Wyc.PrintOut
ElseIf Range("Q9").Value = 3 Then Wyd.PrintOut
ElseIf Range("Q9").Value = 4 Then Wye.PrintOut
ElseIf Range("Q9").Value = 5 Then Wyf.PrintOut
ElseIf Range("Q9").Value = 6 Then Wyg.PrintOut
ElseIf Range("Q9").Value = 7 Then Wyh.PrintOut
Else
Wyi.PrintOut
End If
Next