Selected Answer
Alicia,
You didn't attach an Excel file to your question so I've created one (attached below), based on the code provided by the user for my previous Answer New VLOOKUPWORKBOOK.
As that file leaves me, Sheet1 (green) cell J2 has your (UDF) formula:
=vlookupworkbook(A2,A3:H120, 8,0, "master listing")
where the bold bit means the third sheet is ignored.
It looks up the values from (yellow) cell A2 (value 55) but returns 0 (since it isn't on any searched sheet).
Now go to Sheet2 and see (blue) cell A7 is 58 and the 8th column (H7) is 240.
If you change A7 to 55 then go back to Sheet1, you'll see green J2 now shows that 240. Change Sheet2 H7 to 350 say and J2 will be updated to 350.
The UDF result is now "volatile" (and isupdated automatically, if autocalculation is set).
This is done by the addition of the line in bold below within Module1 code:
Function VLOOKUPWORKBOOK( _
lookup_value As Variant, _
table_array As Range, _
col_index_num As Integer, _
Optional range_lookup As Boolean, _
Optional sheets_to_exclude_1 As String, _
Optional sheets_to_exclude_2 As String, _
Optional sheets_to_exclude_3 As String, _
Optional sheets_to_exclude_4 As String, _
Optional sheets_to_exclude_5 As String)
Application.Volatile True
Dim mySheet As Worksheet
Dim value_to_return
Dim sheets_to_exclude
On Error Resume Next
'Put sheets to exclude into an array
sheets_to_exclude = Array(sheets_to_exclude_1, sheets_to_exclude_2, sheets_to_exclude_3, sheets_to_exclude_4, sheets_to_exclude_5)
'Cycle through all sheets in the workbook
For Each mySheet In ActiveWorkbook.Worksheets
'Check if the sheet needs to be excluded or not.
If Not (UBound(Filter(sheets_to_exclude, mySheet.Name)) > -1) Then
With mySheet
Set table_array = .Range(table_array.Address)
'Run the actual vlookup function on the current sheet that is being looped though.
value_to_return = WorksheetFunction.VLookup(lookup_value, table_array, col_index_num, range_lookup)
End With
'Exit the loop once have a value to return.
If Not IsEmpty(value_to_return) Then
Exit For
End If
End If
Next mySheet
'Send the result back to the cell that contains the function.
VLOOKUPWORKBOOK = value_to_return
End Function
Hope this makes sense and solves your problem. if so, please remember to mark this Answer as Selected (you may have to Deselect Willie's Answer which pointed to my earlier Answer, as referenced above).