Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default How do I control the cell reference when naming a cell in a macro

When recording a macro that creates or defines a range name for a cell, I can
programantically get to the cell I want, but the recorded macro adds a fixed
reference (see example below) that I'd like to control without using a
combination of numeric and string variables. I'd like to create the name
using an active cell reference. Is this possible?

ActiveWorkbook.Names.Add Name:="TOT", RefersToR1C1:="=PgrmPvtName!R4C38"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 461
Default How do I control the cell reference when naming a cell in a macro

Try



ActiveWorkbook.Names.Add Name:="TOT", RefersTo:="=" & ActiveCell.Address

"Glenn" wrote:

When recording a macro that creates or defines a range name for a cell, I can
programantically get to the cell I want, but the recorded macro adds a fixed
reference (see example below) that I'd like to control without using a
combination of numeric and string variables. I'd like to create the name
using an active cell reference. Is this possible?

ActiveWorkbook.Names.Add Name:="TOT", RefersToR1C1:="=PgrmPvtName!R4C38"

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default How do I control the cell reference when naming a cell in a ma

Worked great....
Thanks a whole bunch.

"AKphidelt" wrote:

Try



ActiveWorkbook.Names.Add Name:="TOT", RefersTo:="=" & ActiveCell.Address

"Glenn" wrote:

When recording a macro that creates or defines a range name for a cell, I can
programantically get to the cell I want, but the recorded macro adds a fixed
reference (see example below) that I'd like to control without using a
combination of numeric and string variables. I'd like to create the name
using an active cell reference. Is this possible?

ActiveWorkbook.Names.Add Name:="TOT", RefersToR1C1:="=PgrmPvtName!R4C38"

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 worksheets tabs from another cell reference Finance Guru Excel Worksheet Functions 2 July 1st 09 07:00 PM
Tab naming from a Reference cell Finance Guru Excel Worksheet Functions 14 June 15th 09 12:13 PM
Naming a worksheet tab from a reference cell Finance Guru Excel Worksheet Functions 2 June 12th 09 03:08 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Form Control for Cell Reference John Hutcins Excel Programming 3 February 15th 06 09:24 PM


All times are GMT +1. The time now is 04:44 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"