Young_Money
New Member
- Joined
- Jul 8, 2011
- Messages
- 23
Hi guys.. My question today is how do I get my UDF to run in all worksheets of my excel file?
Here is the code I have that runs on one worksheet
Function Custom_Lookup(ByVal Client_Initials As String) As String
Dim r
For Each r In Range("B:B")
If r = Client_Initials Then
Custom_Lookup = r.Offset(0, 1)
Exit Function
End If
Next
Custom_Lookup = "Not Found"
End Function
It runs the worksheet NewContractOrder
However, I want it to be able to run on a worksheet top opportunity and opportunity as well.
All 3 worksheets have the same format, so the function will work correctly on all of them..but my question is how to get the function to work in all 3 excel sheets instead of just NewContractOrder.
Any help would be appreciated!
Here is the code I have that runs on one worksheet
Function Custom_Lookup(ByVal Client_Initials As String) As String
Dim r
For Each r In Range("B:B")
If r = Client_Initials Then
Custom_Lookup = r.Offset(0, 1)
Exit Function
End If
Next
Custom_Lookup = "Not Found"
End Function
It runs the worksheet NewContractOrder
However, I want it to be able to run on a worksheet top opportunity and opportunity as well.
All 3 worksheets have the same format, so the function will work correctly on all of them..but my question is how to get the function to work in all 3 excel sheets instead of just NewContractOrder.
Any help would be appreciated!