This is the first time I have ever tried to write my own function, and I'm not sure what I am doing wrong, but this is not working. I am trying to get a function to search for a value across multiple sheets, and if it finds a match then return the name of the sheet that the value was found on. Here is what I have so far:
Public Function SearchSheets(fText As String)
Dim sText As String
Dim i, x
Dim lastrow As Long
Dim Sheet(1 To 6) As Worksheet
For x = 1 To 6
lastrow = Sheet(x).Range("A" & Rows.Count).End(3)(1)
For i = 2 To lastrow
sText = Sheet(x).Range("C" & i).Text
If sText = fText Then GoTo 1000
Next i
Next x
1000 SearchSheets = Sheet(x).Name
End Function
Bookmarks