Submitted by JXB on Tue, 09/09/2014 - 09:40
Forums:
To all
is there a way of getting the last row in a user supplied xls.worksheet. I usually use
Dim lastrow as integer
lastrow = xlSheet.Range("A65000").End(xlUp).Row
but NX flags an error abut 'xlup' not being defined
Thanks
Regards
re: xlup
"xlup" is a constant defined in the Excel libraries. If you are using a journal, you cannot use it directly (as you cannot reference the MSOffice/Excel libraries directly); however, you can 'make' your own. Open Excel and the VBA editor, open the object browser and search for "xlup". In the bottom panel, you'll see the value of xlup (-4162). In your journal code, you can use this value directly; or re-create the xlup constant to use in your code.
Const xlup as integer = -4162
Dim lastrow as integer
lastrow = xlSheet.Range("A65000").End(xlUp).Row
Thanks. works a treat
Thanks. works a treat
Thanks
Regards