Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Refers to active cells

I have this line of code is there a way to change the RefersTo section to
ReferTo the active cells?

ActiveWorkbook.Names.Add Name:="OBM", RefersToR1C1:="=Densities!R4C6:R139C6"

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Refers to active cells

Hi

This should do it:

MyList = Selection.Address
ActiveWorkbook.Names.Add Name:="OBM", RefersTo:="=Densities!" & MyList

Regards,
Per

"Miree" skrev i meddelelsen
...
I have this line of code is there a way to change the RefersTo section to
ReferTo the active cells?

ActiveWorkbook.Names.Add Name:="OBM",
RefersToR1C1:="=Densities!R4C6:R139C6"

Thank you


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Refers to active cells

Hi
The answer is Yes:
ActiveWorkbook.Names.Add Name:="OBM", RefersToR1C1:=Selection.Address

But I would be careful about that.

HTH
Cordially
Pascal

"Miree" a écrit dans le message de news:
...
I have this line of code is there a way to change the RefersTo section to
ReferTo the active cells?

ActiveWorkbook.Names.Add Name:="OBM",
RefersToR1C1:="=Densities!R4C6:R139C6"

Thank you



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Refers to active cells

Since active cells could be from another sheet:
shname = ActiveSheet.Name & "!"
ActiveWorkbook.Names.Add Name:="OBM", RefersToR1C1:=shname &
Selection.Address

But I still think this is a little dangerous.

HTH
Cordially
Pascal

"papou" a écrit dans le message
de news: ...
Hi
The answer is Yes:
ActiveWorkbook.Names.Add Name:="OBM", RefersToR1C1:=Selection.Address

But I would be careful about that.

HTH
Cordially
Pascal

"Miree" a écrit dans le message de news:
...
I have this line of code is there a way to change the RefersTo section to
ReferTo the active cells?

ActiveWorkbook.Names.Add Name:="OBM",
RefersToR1C1:="=Densities!R4C6:R139C6"

Thank you





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Refers to active cells

This worked well, but came accross a problem, one of the ranges i need
defined is a combination of two ranges WBM and OBM, is there a way to make
both named ranges active and to name?

Thank you

"papou" wrote:

Hi
The answer is Yes:
ActiveWorkbook.Names.Add Name:="OBM", RefersToR1C1:=Selection.Address

But I would be careful about that.

HTH
Cordially
Pascal

"Miree" a écrit dans le message de news:
...
I have this line of code is there a way to change the RefersTo section to
ReferTo the active cells?

ActiveWorkbook.Names.Add Name:="OBM",
RefersToR1C1:="=Densities!R4C6:R139C6"

Thank you






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Refers to active cells

Another:

with selection
.name = "'" & .parent.name & "'!" & "OBM"
end with

Ps. I wouldn't use this name.

If you ever upgrade to xl2007 (with 16k columns), this will be an invalid
name--it looks too much like a column reference.

I'd use "_OBM"



Miree wrote:

I have this line of code is there a way to change the RefersTo section to
ReferTo the active cells?

ActiveWorkbook.Names.Add Name:="OBM", RefersToR1C1:="=Densities!R4C6:R139C6"

Thank you


--

Dave Peterson
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
Formula refers to empty cells even when cells contains data Monica Rustogi Excel Worksheet Functions 1 February 25th 10 06:56 PM
Data Valid - refers to the values of 2 cells ash3154 New Users to Excel 5 September 17th 09 04:11 PM
Conditional format refers to two cells DOUG Excel Worksheet Functions 1 June 17th 09 07:29 PM
Where is the Data Tools group Help refers to when splitting cells AndreaW Excel Worksheet Functions 2 November 30th 05 06:02 PM
Macro execution refers not to the active sheet/excel file blop Excel Programming 1 October 29th 03 01:17 PM


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