Mong Thầy và các bạn hỗ trợ...Tham chiếu 2 WorkBooks theo Range (1 người xem)

  • Thread starter Thread starter ninh_lu
  • Ngày gửi Ngày gửi
Liên hệ QC

Người dùng đang xem chủ đề này

ninh_lu

Thành viên mới
Tham gia
28/5/15
Bài viết
24
Được thích
1

Dear Thy và cácbn.

Em có đon codesau chy tham chiếu gia 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:
Web KT

Bài viết mới nhất

Back
Top Bottom