Dear Thầy và cácbạn.
Em có đoạn codesau chạy tham chiếu giữa 2 workbooks…Và tham chiếu theo Range như “embevinhphuc” có sửdụng. Nhưng không hiểu sao chạy không được và nó báo lỗi “ Application-defined orobject define error “ở dòng code bên dưới mà em có Highlight màu đỏ đậm
Rấtmong Thầy và các bạn coi giùm ạ.
Emxin cảm ơn!
“OptionExplicit
SubPCMA_Button1_Click()
Dim i As Integer
Dim j As Integer
Dim a21 As Integer
Dim result As String
result = InputBox("Pls kindly inputPassword..!", "Authentication")
If result = "112233" Then
WithApplication
.Interactive= False
.EnableEvents= False
.ScreenUpdating= False
.Calculation= xlCalculationManual
EndWith
For i = 5 To 30 ' so luong nguoi trong 1 bo phan
For j = 17 To 22
If Sheet1.Cells(2, 1) = "21" Then
For a21 = 6 To 11
If Sheet1.Cells(i,2).Text = Workbooks("OVT.xlsm").Sheets(1).Range(Cells(8, 2),Cells(700, 2)) Then
IfSheet1.Cells(4, j).Text = Workbooks("OVT.xlsm").Sheets(1).Cells(7,a21) Then
Workbooks("OVT.xlsm").Sheets(1).Range(Cells(8,a21), Cells(700, a21)) = Sheet1.Cells(i, j).Text
EndIf
EndIf
Next a21
EndIf
Next j
Next i
WithApplication
.Interactive= True
.EnableEvents= True
.ScreenUpdating= True
.Calculation= xlCalculationManual
EndWith
Else
MsgBox " Invalid Password..."
EndIf
EndSub “
Lần chỉnh sửa cuối: