Multiple Instances In Search

Faiek

New Member
Joined
May 2, 2011
Messages
48
Hi,
I have this code used to search:

Code:
Dim Crossrefvalue As Variant
Crossrefvalue = Application.VLookup(Search.TextBox1.Value, Range("Crossreftable"), 2, 0)

Is there a way to make a code that uses this search and see's if there are multiple instances of the searched value, and if there is display both values and there offset-ted values in other textboxes.

Thanks
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi Faiek,

The Find...FindNext solution to your recent post seems like a much better approach than using a Vlookup.

http://www.mrexcel.com/forum/showthread.php?t=558175&page=2

Vlookup is usually only used when you need to find a single record and it isn't very good for multiple instances.

Is there some reason the Find...FindNext approach isn't doing what you need it to do?

Thanks, Your right, One Question thought How Do I Only Use the Find Function to search in a specific column and not the whole sheet?
 
Upvote 0
Thanks, Your right, One Question thought How Do I Only Use the Find Function to search in a specific column and not the whole sheet?

If you only want to search Column B, at these two locations in your code.....
Rich (BB code):
Set FoundCell = wks.Cells.Find(what:=Me.TextBox1.Value, _
    LookIn:=xlValues, Lookat:=xlWhole, MatchCase:=False)
'....
'....
Set FoundCell = wks.Cells.FindNext(After:=FoundCell)

...replace .Cells with .Columns("B")
Rich (BB code):
Set FoundCell = wks.Columns("B").Find(what:=Me.TextBox1.Value, _
    LookIn:=xlValues, Lookat:=xlWhole, MatchCase:=False)
'....
'....
Set FoundCell = wks.Columns("B").FindNext(After:=FoundCell)
 
Upvote 0

Forum statistics

Threads
1,224,516
Messages
6,179,231
Members
452,898
Latest member
Capolavoro009

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top