Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 295
Default Naming a cell from VB

Hello there, I want to set up a procedure to insert somes names into a
workbook that refer to another workbook (because the formulas in Excel get
WAY too long otherwise) and am using the following code (which of course does
not work):

ActiveWorkbook.Names.Add Name:="dens", _
RefersToR1C1:="=[Tbl.cost.xls]tbl.cost!R" & namerow & "C" & namecol

IT'S THE "RefersTo" THAT IT DOES NOT LIKE.

The following code is what I get from recording a macro, but I can't use it
because the cell locations may change from time to time:
ActiveWorkbook.Names.Add Name:="tbl.cost", _
RefersToR1C1:="=[Tbl.cost.xls]tbl.cost!R3C2:R228C63"

Can someone steer me in the right direction please? Regards, Brett
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default Naming a cell from VB

It worked fine in my little test.

What do you have in namecol and namerow at that point?

--
__________________________________
HTH

Bob

"Brettjg" wrote in message
...
Hello there, I want to set up a procedure to insert somes names into a
workbook that refer to another workbook (because the formulas in Excel get
WAY too long otherwise) and am using the following code (which of course
does
not work):

ActiveWorkbook.Names.Add Name:="dens", _
RefersToR1C1:="=[Tbl.cost.xls]tbl.cost!R" & namerow & "C" & namecol

IT'S THE "RefersTo" THAT IT DOES NOT LIKE.

The following code is what I get from recording a macro, but I can't use
it
because the cell locations may change from time to time:
ActiveWorkbook.Names.Add Name:="tbl.cost", _
RefersToR1C1:="=[Tbl.cost.xls]tbl.cost!R3C2:R228C63"

Can someone steer me in the right direction please? Regards, Brett



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 295
Default Naming a cell from VB

Hi Bob, there was garbage in there, and I assumed there wasn't. Ooops! Thank
for the tip. Brett

"Bob Phillips" wrote:

It worked fine in my little test.

What do you have in namecol and namerow at that point?

--
__________________________________
HTH

Bob

"Brettjg" wrote in message
...
Hello there, I want to set up a procedure to insert somes names into a
workbook that refer to another workbook (because the formulas in Excel get
WAY too long otherwise) and am using the following code (which of course
does
not work):

ActiveWorkbook.Names.Add Name:="dens", _
RefersToR1C1:="=[Tbl.cost.xls]tbl.cost!R" & namerow & "C" & namecol

IT'S THE "RefersTo" THAT IT DOES NOT LIKE.

The following code is what I get from recording a macro, but I can't use
it
because the cell locations may change from time to time:
ActiveWorkbook.Names.Add Name:="tbl.cost", _
RefersToR1C1:="=[Tbl.cost.xls]tbl.cost!R3C2:R228C63"

Can someone steer me in the right direction please? Regards, Brett




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default Naming a cell from VB

Sometimes you just need that other view <g

--
__________________________________
HTH

Bob

"Brettjg" wrote in message
...
Hi Bob, there was garbage in there, and I assumed there wasn't. Ooops!
Thank
for the tip. Brett

"Bob Phillips" wrote:

It worked fine in my little test.

What do you have in namecol and namerow at that point?

--
__________________________________
HTH

Bob

"Brettjg" wrote in message
...
Hello there, I want to set up a procedure to insert somes names into a
workbook that refer to another workbook (because the formulas in Excel
get
WAY too long otherwise) and am using the following code (which of
course
does
not work):

ActiveWorkbook.Names.Add Name:="dens", _
RefersToR1C1:="=[Tbl.cost.xls]tbl.cost!R" & namerow & "C" & namecol

IT'S THE "RefersTo" THAT IT DOES NOT LIKE.

The following code is what I get from recording a macro, but I can't
use
it
because the cell locations may change from time to time:
ActiveWorkbook.Names.Add Name:="tbl.cost", _
RefersToR1C1:="=[Tbl.cost.xls]tbl.cost!R3C2:R228C63"

Can someone steer me in the right direction please? Regards, Brett






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell and tab naming bpoland58 Excel Discussion (Misc queries) 1 December 13th 07 06:27 PM
tab naming from a set cell duckie Excel Discussion (Misc queries) 1 October 3rd 07 09:57 AM
Naming a cell Yan Cossette Excel Worksheet Functions 8 September 23rd 06 07:40 PM
What is wrong with naming a cell as c? vezerid Excel Discussion (Misc queries) 4 January 31st 06 08:57 PM
Naming a cell mike Excel Worksheet Functions 2 January 12th 05 11:31 PM


All times are GMT +1. The time now is 06:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"