Sorry ban !
mình gửi lại file
và đoạn code bên dưới :
Private Sub CommandButton1_Click()
Dim newWB As Workbook
Dim hang_sheetnguon As Long
Dim hang_sheetmoi As Long
Dim tongsohang As Integer
Dim stthang As Integer
tongsohang = Sheets("sheetnguon").Range("B" & Rows.Count).End(xlUp).Row
Set newWB = Workbooks.Add
hang_sheetmoi = 1
stthang = 10
For hang_sheetnguon = 5 To tongsohang
If Sheets("sheetnguon").Cells(hang_sheetnguon, 7) > 0 Then
newWB.Sheets("sheet1").Cells(hang_sheetmoi, 1) = Sheets("sheetnguon").Cells(hang_sheetnguon, 2)
newWB.Sheets("sheet1").Cells(hang_sheetmoi, 2) = 10
newWB.Sheets("sheet1").Cells(hang_sheetmoi, 3) = Sheets("sheetnguon").Cells(hang_sheetnguon, 5)
newWB.Sheets("sheet1").Cells(hang_sheetmoi, 3) = Sheets("sheetnguon").Cells(hang_sheetnguon, 7)
End If
hang_sheetmoi = hang_sheetmoi + 1
stthang = stthang + 10
Next
End Sub
=> khi click nút tạo file tạm thì nó báo lổi : Run time error '9' : subcript out of range
bạn giúp mình với