|
-
May 5th, 2004, 08:47 AM
#1
Thread Starter
Hyperactive Member
excel problem.....
i've got a list of names in column A:H and i want a textbox and a commandbutton that can be used to search the list of items I've got in column A
i.e. In column A I've got a list of computer brands and by using the search button it will show the results that match up on columns I:O
Can anyone show me a code for this if it is possible to do.
Thanx for ur time,
Greyskull
-
May 5th, 2004, 07:40 PM
#2
Addicted Member
I can't picture what you are trying to do at all.
Can you upload a small example sheet or something?
Column A has computer brand names
Columns B:H have.... ?
Columns I:O have.......?
What is matching what?
-
May 6th, 2004, 12:50 AM
#3
Member
Hi,
I don't understand why would you need a Textbox and a commandbutton to do this.
Put this code on a button and it will do for you.
Sub FindThis()
Dim MyValue, MyFindNext
[A1].Select
MyValue = InputBox("What Would you Like To Search.", "Company Name")
On Error GoTo err_Trap
Cells.Find(What:=MyValue, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Activate
MyFindNext = vbYes
Do Until MyFindNext <> vbYes
MyFindNext = MsgBox("Would you like to find the next instance of " & MyValue & "?", _
vbYesNo, "Find Next")
If MyFindNext = vbNo Then
Exit Sub
End If
Cells.FindNext(After:=ActiveCell).Activate
Loop
On Error GoTo 0
Exit Sub
err_Trap:
If Err.Number = 91 Then
MsgBox "Could not find " & MyValue & " anywhere on this sheet.", , "Unsuccessful search"
Else
MsgBox Err.Number & ": " & Err.Description
End If
End Sub
Best Regards,
S h a n
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|