xlconnect
xlconnect copied to clipboard
readNamedRegion and Local (sheet scoped) Names ?
I have two sheets in my workbook. In each one a local (sheet-scoped) name "Hugo" is defined refering to the cell B2 in the specific worksheet. The values in the cells are 122 resp. 222.
getDefinedNames(wb) [1] "Hugo" "Hugo"
readNamedRegion(wb, 'Hugo') [1] Col1 <0 rows> (or 0-length row.names)
From my point of view it seems to be unpossible to retrieve the value 222 stored in the cell named "Hugo" in Worksheet(2) via readNamedRegion.
To reproduce the issue the following Excel Macro might be helpful: Sub DefineNameHugoInTwoSheets() Dim wsX As Worksheet, i As Integer, sSheetName As String, sNameName As String For i = 1 To 2 Set wsX = Worksheets(i) wsX.Activate sSheetName = wsX.Name sNameName = "Hugo" wsX.Names.Add sNameName, "=$B$2" wsX.Range(sNameName).Value = i * 100 + 22 Next i End Sub
+1
This should be possible as the sheet id is stored along with the range names in the workbook xml. There should be an additional sheet argument.
+1
I also would like to have the sheet names returned from the getReferenceCoordinatesFromName() function, which I think is the same issue,