View Single Post
 
Old 08-11-2022, 09:14 AM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2019
Expert
 
Join Date: Apr 2014
Posts: 867
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Quote:
Originally Posted by Debaser View Post
Your issue is here:

Code:
vlookupUDF = Cells(nrow, ncollumn)
that will return the value from whichever sheet is active when the formula calculates. You should use interval.worksheet.cells(nrow, ncollumn)

Ah yes, well spotted.
Code:
vlookupUDF = interval.parent.Cells(nrow, ncollumn)
should do it (untested).
edit:
just noticed you used interval.worksheet.cells ; I've never seen that, going to try it now.
Reply With Quote