I have a named cell "kneeheight" on sheet "Order Entry" (sheet0)
A macro is called from a button on the active sheet "Drawing" (sheet1). When I use getCellRangebyName("kneeheight"), I get an error. However when I copy the button to the sheet "Order Entry" (sheet0) it works.
Is there a way to get the value of a named range that is not on the active sheet?
Thanks
[Solved] Get value of named cell when sheet is unknown
[Solved] Get value of named cell when sheet is unknown
Last edited by Hagar Delest on Tue Aug 14, 2012 8:30 am, edited 1 time in total.
Reason: tagged [Solved].
Reason: tagged [Solved].
OpenOffice 4.1.7 on Windows 10
Re: get value of named cell when sheet is unknown
I did more googling and got this working:
KneeType = oDoc.NamedRanges.getByName("kneetype").getReferredCells.value
What would be the equivalent code if the cell contains text? I tried ".string" which does not work
Thank you.
KneeType = oDoc.NamedRanges.getByName("kneetype").getReferredCells.value
What would be the equivalent code if the cell contains text? I tried ".string" which does not work
Thank you.
OpenOffice 4.1.7 on Windows 10
Re: get value of named cell when sheet is unknown
Every cell has a String property, so that should work. This worked for me
What do you mean when you say it didn't work?
Code: Select all
CellString = ThisComponent.NamedRanges.getByName("First").ReferredCells.String
Print CellStringOpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Get value of named cell when sheet is unknown
Thanks FJCC
oo maros are so quirky... I noticed you used "ReferredCells" as opposed to my "getReferredCells" and both seem to work fine with
Bone head mistake, I did not think that my named range could be misspelled, but guess what, it was
Thanks
oo maros are so quirky... I noticed you used "ReferredCells" as opposed to my "getReferredCells" and both seem to work fine with
Bone head mistake, I did not think that my named range could be misspelled, but guess what, it was
Thanks
OpenOffice 4.1.7 on Windows 10