How can I use Application.XLookup across every sheet in my workbook?

DrCheese1023

New Member
Joined
Jun 28, 2021
Messages
10
Office Version
  1. 2019
Platform
  1. Windows
Here is my code, first off:

VBA Code:
Sub namelookup()
SalesForm.BHSDTAPNAMELF.Value = Application.XLookup(Val(SalesForm.BHSDMAINNUMBERLF.Value), Worksheets("NICK TAPS").Range("S:S"), Worksheets("NICK TAPS").Range("T:T"), Application.XLookup(Val(SalesForm.BHSDMAINNUMBERLF.Value), Worksheets("CB TAPS").Range("S:S"), Worksheets("CB TAPS").Range("T:T"), Application.XLookup(Val(SalesForm.BHSDMAINNUMBERLF.Value), Worksheets("GG TAPS").Range("S:S"), Worksheets("GG TAPS").Range("T:T"))))
End Sub


This worked for what I needed at the time, but how can I adjust this to not only look through specified sheets, but every single sheet on a workbook? I dont want to manually add to the code every time i change my sheets.

Crossposted @ How can I use Application.XLookup across every sheet in my workbook?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I see it looks like you got the solution you needed on the link you provided.
 
Upvote 0

Forum statistics

Threads
1,215,212
Messages
6,123,653
Members
449,111
Latest member
ghennedy

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