cho e hỏi câu lệnh của e là nếu giá trị tỏng ô di không tìm thấy trong 1 bảng thì trả về giá trị trống, s lại báo lỗi ha thầy
chào bạn bạn debug xem giá trị đó đang trả ra là gì nhé.
thầy xem giúp e
Chào bạn bạn có thể đẩy file lên giúp gitiho không?
Chào bạn vấn đề thắc mắc của bạn đng nằm ở module nào nhỉ?>
Sub Tim_DVT_Gia_1(). nha thầy
Chào bạn bạn có thể làm như sau nhé
Sub Tim_DVT_Gia_1()
Dim DC As Long, i As Long, DC_Sheet3 As Long
DC_Sheet3 = Sheet3.Range("B" & Rows.Count).End(xlUp).Row
DC = Sheet34.Range("c" & Rows.Count).End(xlUp).Row
Sheet34.Range("D12:D" & DC).ClearContents
For i = 12 To DC
Dim a As String
On Error Resume Next
a = WorksheetFunction.IfError(Application.WorksheetFunction.VLookup(Sheet34.Range("C" & i).Value, Sheet3.Range("b3:c" & DC_Sheet3 - 2), 2, False), "")
If (Sheet34.Range("D" & i).Value <> a) Then
Sheet34.Range("D" & i).Value = ""
Else
Sheet34.Range("D" & i).Value = Application.WorksheetFunction.VLookup(Sheet34.Range("C" & i).Value, Sheet3.Range("b3:c" & DC_Sheet3 - 2), 2, False)
End If
Sheet34.Range("e" & i).Value = Application.WorksheetFunction.VLookup(Sheet34.Range("C" & i).Value, Sheet3.Range("b3:d" & DC_Sheet3 - 2), 3, False)
Next
Sheet34.Range("a12:M" & DC).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
End Sub
cảm ơn thầy nhé
ở đây là hàm vlookup nó ko tìm ra yêu cầu của bạn
e sữa lại như vật vẫn dc à thầy
được bạn ơi do hàm on error resume next nó bỏ qua lỗi