ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   HOWTO Reference a named cell or range in a script (https://www.excelbanter.com/excel-discussion-misc-queries/200813-howto-reference-named-cell-range-script.html)

pwrichcreek

HOWTO Reference a named cell or range in a script
 
In a windows script I have the following statement to put a value
into a worksheet that I have opened in the script:

objExcel.Cells(1, 1).Value = "y"

If I assign a name to cell 1,1 in EXCEL -- say for example print_Y_or_N --
can I then refer to cell 1,1 (in the script) using that name? Sortof like you
could in a VBA macro, like

[print_Y_or_N] = "y"

I think using a name instead of hard-coded cell cooridnate improves
maintainability. Doesn't it?

TIA,

Phil



FSt1

HOWTO Reference a named cell or range in a script
 
hi
yes. but the syntax would be more like this.

Range("print_Y_or_N") = "Y"

regards
FSt1

"pwrichcreek" wrote:

In a windows script I have the following statement to put a value
into a worksheet that I have opened in the script:

objExcel.Cells(1, 1).Value = "y"

If I assign a name to cell 1,1 in EXCEL -- say for example print_Y_or_N --
can I then refer to cell 1,1 (in the script) using that name? Sortof like you
could in a VBA macro, like

[print_Y_or_N] = "y"

I think using a name instead of hard-coded cell cooridnate improves
maintainability. Doesn't it?

TIA,

Phil



pwrichcreek

HOWTO Reference a named cell or range in a script
 
Thanks for your reply FSt1.

objExcel.Range("automationFlag") = "Y"

did the trick.

Phil

"FSt1" wrote:

hi
yes. but the syntax would be more like this.

Range("print_Y_or_N") = "Y"

regards
FSt1

"pwrichcreek" wrote:

In a windows script I have the following statement to put a value
into a worksheet that I have opened in the script:

objExcel.Cells(1, 1).Value = "y"

If I assign a name to cell 1,1 in EXCEL -- say for example print_Y_or_N --
can I then refer to cell 1,1 (in the script) using that name? Sortof like you
could in a VBA macro, like

[print_Y_or_N] = "y"

I think using a name instead of hard-coded cell cooridnate improves
maintainability. Doesn't it?

TIA,

Phil




All times are GMT +1. The time now is 09:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com