xlconnect icon indicating copy to clipboard operation
xlconnect copied to clipboard

readNamedRegion and Local (sheet scoped) Names ?

Open Rolf61 opened this issue 11 years ago • 4 comments
trafficstars

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

Rolf61 avatar Jul 25 '14 13:07 Rolf61

+1

danielkrizian avatar Oct 22 '14 09:10 danielkrizian

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.

joefogarty avatar Dec 02 '15 14:12 joefogarty

+1

bescoto avatar Mar 02 '17 23:03 bescoto

I also would like to have the sheet names returned from the getReferenceCoordinatesFromName() function, which I think is the same issue,

woodwards avatar Mar 08 '19 00:03 woodwards