UDF Issue

oddworld

Active Member
Joined
May 31, 2005
Messages
250
hi all, i am using a udf that uses vlookallsheets, the code below needs teaking, I would like to know how to add another sheet (Summary!) in this line, i dont know how its written

[If wSheet.Name <> "master" Then],

is it something like -- If wSheet.Name <> "master" and & or "summary" Then????

any assistance would be appreciated


full code =
[Function VLOOKAllSheets( _
Look_Value As Variant, _
Tble_Array As Range, _
Col_num As Integer, _
Optional Range_look As Boolean)
''''''''''''''''''''''''''''''''''''''''''''''
'Use VLOOKUP to Look across ALL Worksheets and stops _
'at the first match found.
'''''''''''''''''''''''''''''''''''''''''''''''''
Dim wSheet As Worksheet
Dim vFound

On Error Resume Next
For Each wSheet In ActiveWorkbook.Worksheets
If wSheet.Name <> "master" Then
With wSheet
Set Tble_Array = .Range(Tble_Array.Address)

vFound = WorksheetFunction.VLookup _
(Look_Value, Tble_Array, _
Col_num, Range_look)

End With

If Not IsEmpty(vFound) Then Exit For
End If
Next wSheet
Set Tble_Array = Nothing
VLOOKAllSheets = vFound
End Function]
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Try

Code:
If wSheet.Name <> "master"  AND wSheet.Name <> "Summary" then
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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