Sub InPhieu()
Dim rng As Range, Arr, i As Long, Cll, Sure
On Error GoTo Error1
Set rng = Application.InputBox( _
"Vui long quet chon vung co MS KHACH HANG can in " & _
vbNewLine & vbNewLine & vbNewLine & _
vbNewLine & "cot B Sheet DANHSACH ", "Chon ma so khach hang", Type:=8)
Sure = MsgBox("Ban co muon in " & rng.Count & " hoa don khong?", vbYesNo, "Are you sure?")
If Sure = vbYes Then
ReDim Arr(1 To rng.Count + 1)
For Each Cll In rng
i = i + 1
Arr(i) = Cll.Value
Next
For i = 1 To rng.Count Step 2
[AK4] = Arr(i)
[AK31] = Arr(i + 1)
HideShapes
ActiveSheet.PrintPreview
Next
MsgBox "Ban da in " & rng.Count & " hoa don"
Else
GoTo Error1
End If
Exit Sub
Error1:
MsgBox "Ban da khong chon in"
End Sub