XcelNoobster
New Member
- Joined
- Jun 7, 2022
- Messages
- 40
I need some help with using the .find to search through numerous sheets.
I have a sheet with Ids that I want to loop through each one and search each sheet for that value's location then output the location on a new sheet called "Results"
This is what I have so far but getting an error and not sure if my logic is correct.
I have a sheet with Ids that I want to loop through each one and search each sheet for that value's location then output the location on a new sheet called "Results"
This is what I have so far but getting an error and not sure if my logic is correct.
VBA Code:
Sub findIds()
Dim I As Long, temp As String
Dim A As Integer
Dim firstAddress As String
Dim sht As Worksheet
Dim c As Range
For I = 1 To Range("A" & Rows.Count).End(xlUp).Row
temp = Cells(I, "A").Value
For Each sht In ThisWorkbook.Sheets
Set c = .Find(temp, LookIn:=xlValues)
If Not x Is Nothing Then
firstAddress = c.Address
Do
Sheets("Results").Range("D" & I) = firstAddress
End If
Next sht
Next I
End Sub