Option Explicit
Sub TimChuoi()
Dim sRng As Range, StrC As String
StrC = InputBox("Ban Càn Tìm Chuoi:", "GPE.COM Xin Chào", "ABAB")
Set sRng = Cells.Find(StrC, , xlFormulas, xlWhole)
If sRng Is Nothing Then
[A1].Value = "Nothing:": [A2].Value = StrC
Else
[A1].Value = sRng.Column: [A2].Value = sRng.Row
End If
End Sub
Sub tim_gia_tri()
Dim gtri
Dim mycell As Range
gtri = Application.InputBox(Prompt:="HungPecc1", Title:="GP.Excel", Type:=10)
Range("A1:A3").ClearContents
For Each mycell In ActiveSheet.UsedRange
If mycell.Value = gtri Then
Range("A1") = mycell.Column
Range("A2") = mycell.Row
Range("A3") = mycell.Address
End If
Next
End Sub
Thế thêm code gì để nó trả về tên của shêet chứa giá trị đó bạn nhởTheo cách mình hiểu , mình viết đoạn code như sau :
chắc bạn cũng biết về VBA , nên mình ko gủi file cel, bạn copy dzo rồi chạy nhé !
Mã:Sub tim_gia_tri() Dim gtri Dim mycell As Range gtri = Application.InputBox(Prompt:="HungPecc1", Title:="GP.Excel", Type:=10) Range("A1:A3").ClearContents For Each mycell In ActiveSheet.UsedRange If mycell.Value = gtri Then Range("A1") = mycell.Column Range("A2") = mycell.Row Range("A3") = mycell.Address End If Next End Sub