Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Can someone help me make this dynamic?

I am trying to give a set of fields range names so that I can use those
names elsewhere in my macros.
In all cases the cell's caption is located in the cell directly left of the
one I want to name.

I search for the caption.
I select the cell to its right
I attempt to name that cell by the range name.

Here is the problem code: RefersToR1C1:= "='IA Control
Documentation'!R9C2"


The problem is that the ReferToR1C1 clause is sticking in what appears to be
a hardcoded reference to a specific cell on a specific sheet.

Yet when I try to refer ActiveCell.Address it tells me I need a collection.
I don't know how to revise that to reference the cell as a collection.

=========================================
'Locate the field that contains the main process name
Range("A1").Select
Cells.Find(What:="Process:", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 1).Select
' Give this a range name
ActiveWorkbook.Names.Add Name:="ProcessName", RefersToR1C1:= _
"='IA Control Documentation'!R9C2"
===========================================

--
Henry Stock,
onProject.com
3 Wing Drive
Cedar Knolls, NJ 07927-1006



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Can someone help me make this dynamic?

Hi Henry,

Try replacing the following lines:

ActiveCell.Offset(0, 1).Select
' Give this a range name
ActiveWorkbook.Names.Add Name:="ProcessName", RefersToR1C1:= _
"='IA Control Documentation'!R9C2"

with these lines:

' also select the cell to the right
ActiveCell.Resize(1, 2).Select
' give this cell the range name
Selection.CreateNames Left:=True

Gary

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
How can I make a vLookup dynamic? smonczka Excel Worksheet Functions 1 June 4th 08 03:09 PM
how to make a dynamic workbook? ruchie Excel Discussion (Misc queries) 0 June 6th 07 08:40 PM
How to make worksheet names dynamic? Neil Mitchell-Goodson Excel Worksheet Functions 6 July 18th 06 01:26 PM
Make dynamic charts more dynamic Milo Charts and Charting in Excel 1 April 12th 06 09:01 AM
PivotChart: how to make it dynamic? Valeria Charts and Charting in Excel 1 December 16th 04 01:02 PM


All times are GMT +1. The time now is 12:32 AM.

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"