Skip to main content

Excel: Workbook.Names.Add

  • October 17, 2012
  • 1 reply
  • 0 views

Hello,

i have the next problem with Excel to give a cell a name.

Excel Macro looks like this:
ActiveWorkbook.Names.Add Name:="David", RefersToR1C1:= _ "='Table 1'!R1C1"

I tested several spellings to get it to work and i am atm at this point:
modify xls-book @Names::@Add ( "David", "='Table 1'!$A$1" ).
This is the only spelling which is accepted from Excel without an Error.

But in Excel i get i reference to Cell:
='Table 1'!#REF

When i set a Range before and use it to set the Cell:
inquire xls-sheet @CELLS::@ITEM(1, "A") xls-range.
modify xls-book @Names::@Add ("David", xls-range ).

Then i get also in Excel the reference to the Cell:
='Table 1'#REF

When i use the R1C1-Spelling i get a Formula Error from Excel.

Can anyone give some advice?

1 reply

  • Author
  • Rocketeer
  • 19312 replies
  • October 18, 2012

Hello,

i have the next problem with Excel to give a cell a name.

Excel Macro looks like this:
ActiveWorkbook.Names.Add Name:="David", RefersToR1C1:= _ "='Table 1'!R1C1"

I tested several spellings to get it to work and i am atm at this point:
modify xls-book @Names::@Add ( "David", "='Table 1'!$A$1" ).
This is the only spelling which is accepted from Excel without an Error.

But in Excel i get i reference to Cell:
='Table 1'!#REF

When i set a Range before and use it to set the Cell:
inquire xls-sheet @CELLS::@ITEM(1, "A") xls-range.
modify xls-book @Names::@Add ("David", xls-range ).

Then i get also in Excel the reference to the Cell:
='Table 1'#REF

When i use the R1C1-Spelling i get a Formula Error from Excel.

Can anyone give some advice?

my mistake... the code works. I added it in our excel-test program and the row is later from another code modfied and destroys the name.