PyXLL Users' Forum
Discussion and Informal PyXLL Support => General Discussion => Topic started by: bhontz on July 30, 2015, 09:26:16 PM
I'm attempting to write an extension to the VLookup function. I believe I'm having a problem when I attempt to pass an var array an Excel range to the VLookup function.
@xl_func("string name, var r, int c: var")
def blookup(name, r, c):
s = xl_app().WorksheetFunction.VLookup(name, r, c, False)
re: the above, I believe the problem is that the VLookup Worksheet method is expecting an Excel range and not a var.
Is there a way to assign or cast an var to an Excel range that VLookup can digest?
Thanks in advance,
(replying to my own thread)
I believe my question boils down to, how can you identify the cell addresses of an the cells in an array passed to a function?
I have their values, but as I'm looking to pass along the array to a WorksheetFunction I additionally need the Excel Range (the addresses of the cells) represented by the array's values.
apologies for not replying to this earlier. Somehow I missed it...
Perhaps by now you have already figured this out, but you can use the type 'xl_cell' to pass a cell or range reference. You should be able to construct a Range object from the address property - see https://www.pyxll.com/docs/index.html#pyxll.XLCell for details.