abdelfattah
Well-known Member
- Joined
- May 3, 2019
- Messages
- 1,429
- Office Version
- 2019
- 2010
- Platform
- Windows
hi,
i have 4 columns in sheet a= number of code b= the name when i search by inputbox the name it transfer the name to column c and show the number of code to column d
and when i search by inputbox the number of code it transfer the number of code to column d and show the name to column c i need adjusting my code
i have 4 columns in sheet a= number of code b= the name when i search by inputbox the name it transfer the name to column c and show the number of code to column d
and when i search by inputbox the number of code it transfer the number of code to column d and show the name to column c i need adjusting my code
VBA Code:
Sub FindName()
Dim v As String
v = Application.InputBox(Prompt:="Enter Name:", Type:=2)
mesage = ""
For Each r In ActiveSheet.UsedRange
If InStr(1, r.Value, v) > 0 Then
mesage = mesage & r & vbCrLf
End If
Next
If mesage = "" Then
mesage = "Name not found"
End If
MsgBox mesage
End Sub