Private Sub Worksheet_Change(ByVal Target As Range)
If Not interesct(Target, [I3]) Is Nothing Then 'Đ/C Ô diễn ra sự kiện'
Dim Rws As Long
Dim Rng As Range, sRng As Range
Dim MyAdd As String
Rws = [f9].CurrentRegion.Rows.Count
Set Rng = [f9].Resize(Rws, 8)
Set sRng = Rng.Find(Target.Value, , xlFormulas, xlPart)
If sRng Is Nothing Then
MsgBox "Nothing", , "GPE.COM Xin Chào Ban!"
Else
sRng.Select
End If
End If
End Sub
Bạn xài macro sự kiện này:
PHP:Private Sub Worksheet_Change(ByVal Target As Range) If Not interesct(Target, [I3]) Is Nothing Then 'Đ/C Ô diễn ra sự kiện' Dim Rws As Long Dim Rng As Range, sRng As Range Dim MyAdd As String Rws = [f9].CurrentRegion.Rows.Count Set Rng = [f9].Resize(Rws, 8) Set sRng = Rng.Find(Target.Value, , xlFormulas, xlPart) If sRng Is Nothing Then MsgBox "Nothing", , "GPE.COM Xin Chào Ban!" Else sRng.Select End If End If End Sub
Vì thấy trong file có sẵn nhiều macro mà!
Bạn xài macro sự kiện này:
PHP:Private Sub Worksheet_Change(ByVal Target As Range) If Not interesct(Target, [I3]) Is Nothing Then 'Đ/C Ô diễn ra sự kiện' Dim Rws As Long Dim Rng As Range, sRng As Range Dim MyAdd As String Rws = [f9].CurrentRegion.Rows.Count Set Rng = [f9].Resize(Rws, 8) Set sRng = Rng.Find(Target.Value, , xlFormulas, xlPart) If sRng Is Nothing Then MsgBox "Nothing", , "GPE.COM Xin Chào Ban!" Else sRng.Select End If End If End Sub
Mình cần tạo 1 hộp để tìm kiếm dữ liệu, khi cần tìm chỉ cần gõ dữ liệu vào hộp đó và hiển thị ngay đến kết quả, nếu kết quả không có thì hiện bảng thông báo "Thông tin bạn cần tìm hiện không có".
Định dạng dữ liệu mình cần tìm gồm số và chữ.
Vì có thể có 2 kết quả giống nhau nên bạn có thể tạo thêm 1 nút để bấm vào tìm kiếm được không ? bấm vào lần đầu thì hiển thị kết quả đầu tiên, bấm vào lần nữa thì hiển thị kết quả tiếp theo được không nhỉ?
Sub tt()
Dim rng As Range
Set rng = [F10:M60000].Find([I3], , , 1)
If Not rng Is Nothing Then
Application.CommandBars.ExecuteMso ("FindDialogExcel")
Else
MsgBox "nothing"
End If
End Sub


bạn nhấn control F thì có thể tìm được nhiều vị trí
sau khi nó hiệu hôp thoại lên nhấn Find All để tìmMã:Sub tt() Dim rng As Range Set rng = [F10:M60000].Find([I3], , , 1) If Not rng Is Nothing Then Application.CommandBars.ExecuteMso ("FindDialogExcel") Else MsgBox "nothing" End If End Sub
tôi định can thiệp vào control này như quá sức...hihihih....thôi phải làm bằng tay vậy...!!!!