Sub look()
Dim whatwant As String
whatwant = InputBox("Choose Criteria" & Chr(13) _
& "Wildcards such as *Milly* can be used")
'do things with whatwant
End Sub
You need additional code to do something with the results of the entry.
What do you want to do with the result of your search?
Here is some sample code to select a column, do a search and color rows.
Option Compare Text
Sub Delete_By_Criteria()
Dim I As Integer
Dim iLastRow As Integer
Dim Collet As String
Set wks = ActiveSheet
Application.ScreenUpdating = False
Collet = InputBox("Choose Column Letter")
whatwant = InputBox("Choose Criteria" & Chr(13) _
& "Wildcards such as *PY* can be used")
iLastRow = wks.Cells(Rows.Count, Collet).End(xlUp).Row
For I = iLastRow To 1 Step -1
If wks.Cells(I, Collet).Value Like whatwant Then
wks.Rows(I).Interior.ColorIndex = 3
End If
Next I
Application.ScreenUpdating = True
End Sub
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.