Em mới nhập môn VBA. rất mong các anh, chị cao nhân chỉ giúp em lỗi này với ạ
Dim lr As Long, i As Long
'Kiem tra dieu kien
For i = 5 To 17
If Shfrom.Range("F" & i).Value = False Then
MsgBox Shfrom.Range("H" & i).Value
Shfrom.Range("B" & i).Select
Exit Sub
End If
Next i
'Luu vao data
With shdata
lr = .Range("A" & Rows.Count).End(xlUp).Row + 1
Shfrom.Range("AA6:AM6").Copy 'copy
.Range("A" & lr).PasteSpecial xlPasteValues 'paste
Application.CutCopyMode = False
reset 'xoa nhap lai tu dau
MsgBox "Xong!"
Shfrom.Range("B5") = "=MAX('data Ke toan'!A1)+1"
.Range("B8") = "=IFERROR(VLOOKUP(B7;'danh sach'!$G$2:$H$259;2;0);"")"
End With
Dim lr As Long, i As Long
'Kiem tra dieu kien
For i = 5 To 17
If Shfrom.Range("F" & i).Value = False Then
MsgBox Shfrom.Range("H" & i).Value
Shfrom.Range("B" & i).Select
Exit Sub
End If
Next i
'Luu vao data
With shdata
lr = .Range("A" & Rows.Count).End(xlUp).Row + 1
Shfrom.Range("AA6:AM6").Copy 'copy
.Range("A" & lr).PasteSpecial xlPasteValues 'paste
Application.CutCopyMode = False
reset 'xoa nhap lai tu dau
MsgBox "Xong!"
Shfrom.Range("B5") = "=MAX('data Ke toan'!A1)+1"
.Range("B8") = "=IFERROR(VLOOKUP(B7;'danh sach'!$G$2:$H$259;2;0);"")"
End With