Find trong VBA không tìm thấy số liệu, trong khi find Excel lai tìm thấy binh thường?
Mình dùng find trong excel thì tìm thấy bình thường (bỏ chọn Match entire cell contents)
Nhưng khi lập trình Find trong VBA thì nó không tìm thấy được, mong các bạn giúp đở
Có file gửi kèm (ở sheet Find Single)
Mình dùng find trong excel thì tìm thấy bình thường (bỏ chọn Match entire cell contents)
Nhưng khi lập trình Find trong VBA thì nó không tìm thấy được, mong các bạn giúp đở
Có file gửi kèm (ở sheet Find Single)
PHP:
Sub Find_Single() Dim rng, RngKQ As Range
Dim FirstAddress, NextAddress As String
Dim ValueSearch As Single
Set rng = Range("E2:E12")
rng.Interior.ColorIndex = 40
ValueSearch = Application.Max(rng)
Set RngKQ = rng.Find(What:=ValueSearch, LookIn:=xlValues, LookAt:=xlPart)
If RngKQ Is Nothing Then
MsgBox "Khong tim thay cell co ket qua lon nhat"
Else
FirstAddress = RngKQ.Address
RngKQ.Offset(0, 1).Value = FirstAddress
Do Until NextAddress = FirstAddress
Set RngKQ = rng.FindNext(RngKQ)
NextAddress = RngKQ.Address
RngKQ.Offset(0, 1).Value = NextAddress
Loop
End If
End Sub
File đính kèm
Lần chỉnh sửa cuối:


