Find multiple values

atroul

New Member
Joined
Jul 3, 2016
Messages
6
Hello,
I have a workbook with multiple sheets. In the first sheet there are (among others) some values (~500) which I need to search if they exist and where in the other sheets.
In a few words I need the "Find" function for multiple values.
 
I think that the algorithm I posted in my previous post make it easier to understand....
The values are in the sheets in the C column from 23 row to ~200 (the ending row its not the same in every sheet).

The result data can be in a new sheet.
See if this macro does what you want...
Code:
[table="width: 500"]
[tr]
	[td]Sub ListSheetsValuesAreOn()
  Dim X As Long, Data As Variant, Uniques As String, SH As Worksheet, NewSH As Worksheet
  With CreateObject("Scripting.Dictionary")
    For Each SH In Worksheets
      Data = Application.Transpose(SH.Range("C23", SH.Cells(Rows.Count, "C").End(xlUp)))
      For X = 1 To UBound(Data)
        If IsEmpty(.Item(Data(X))) Then
          .Item(Data(X)) = Data(X) & "|" & SH.Name
        ElseIf Data(X) = Split(.Item(Data(X)), "|")(0) And _
               Not .Item(Data(X)) Like "*|*" & SH.Name & "*" Then
          .Item(Data(X)) = .Item(Data(X)) & ", " & SH.Name
        End If
      Next
    Next
    Sheets.Add After:=Sheets(Sheets.Count)
    Set NewSH = ActiveSheet
    NewSH.Range("A1").Resize(.Count) = Application.Transpose(.Items)
  End With
  NewSH.Name = "Result Sheet"
  NewSH.Columns("A").TextToColumns , xlDelimited, , , 0, 0, 0, 0, 1, "|"
  NewSH.Columns("A:B").AutoFit
End Sub[/td]
[/tr]
[/table]
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,216,098
Messages
6,128,812
Members
449,468
Latest member
AGreen17

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