Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Range Naming using cell data

And one final question!

I'm not sure if I have to initialize any variables in my
macro for this one. I'd like to define a cell name using
the first four characters from another cell.

Here's what I had tried, but obviously I'd get an invalid
name:

ActiveWorkbook.Names.Add Name:=Left(Cells
(row_index, "D").Value, 4), RefersToR1C1:=Cells(row_index
+ 1, "C")

Here's a sample cut of the data:

Column C Column D
1 xxxx99999
1 xxxx99999
TOTAL: 2 (blank)

I want to define the cell with TOTAL as "xxxx"

Thank you all again for the assistance!
Ronny

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Range Naming using cell data


Cells(row_index + 1, "C").Name = Left(Cells(row_index, "D").Value)

--
Regards,
Tom Ogilvy


"Ronny Hamida" wrote in message
...
And one final question!

I'm not sure if I have to initialize any variables in my
macro for this one. I'd like to define a cell name using
the first four characters from another cell.

Here's what I had tried, but obviously I'd get an invalid
name:

ActiveWorkbook.Names.Add Name:=Left(Cells
(row_index, "D").Value, 4), RefersToR1C1:=Cells(row_index
+ 1, "C")

Here's a sample cut of the data:

Column C Column D
1 xxxx99999
1 xxxx99999
TOTAL: 2 (blank)

I want to define the cell with TOTAL as "xxxx"

Thank you all again for the assistance!
Ronny



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Range Naming using cell data

Not sure if you have a problem, but it is easier to use

ActiveWorkbook.Activesheet.Cells(row_index + 1, "C").Name=Left(Cells
(row_index, "D").Value, 4)


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Ronny Hamida" wrote in message
...
And one final question!

I'm not sure if I have to initialize any variables in my
macro for this one. I'd like to define a cell name using
the first four characters from another cell.

Here's what I had tried, but obviously I'd get an invalid
name:

ActiveWorkbook.Names.Add Name:=Left(Cells
(row_index, "D").Value, 4), RefersToR1C1:=Cells(row_index
+ 1, "C")

Here's a sample cut of the data:

Column C Column D
1 xxxx99999
1 xxxx99999
TOTAL: 2 (blank)

I want to define the cell with TOTAL as "xxxx"

Thank you all again for the assistance!
Ronny



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Range Naming using cell data

Thank you both! Works perfectly!

Cheers,
Ronny
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
Naming a Data Range NotaTechy Excel Discussion (Misc queries) 2 February 6th 10 10:01 PM
Naming the range of data Chrissy Pitifer Excel Discussion (Misc queries) 1 July 10th 08 09:38 PM
Data Tables and Cell Naming anonymous Excel Discussion (Misc queries) 1 April 10th 07 09:18 AM
Naming cell ranges, copying formulas for a range & nesting "IF" fu DonF Excel Discussion (Misc queries) 3 October 5th 06 05:47 PM
VB Code Naming a Range (range changes each time) krazylain Excel Programming 4 May 15th 04 12:41 PM


All times are GMT +1. The time now is 09:38 AM.

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

About Us

"It's about Microsoft Excel"