Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
Dave
 
Posts: n/a
Default Named Reference

Hi,

Can someone tell me what the pros and cons are (if any) of these 2 ways
of naming a range.

ActiveWorkbook.Names.Add NAME:="HOME", RefersTo:=ActiveCell
Range("HOME").Select

or

Dim HOME As Range
Set HOME = ActiveCell
HOME.Select

Thanks,

DaveU

  #2   Report Post  
Posted to microsoft.public.excel.newusers
Ron Coderre
 
Posts: n/a
Default Named Reference

It seems to me that the first method creates a named range that is
essentially meaningless to the user and is only used for VBA processing.
Additionally, if you don't write code to delete the named range it will just
sit there in the workbook waiting for somebody to ask what it means.

The second alternative is a cleaner way to declare the range variable
without having it intrude upon the user-facing part of the workbook.

Just my opinion....Your mileage may vary.

***********
Regards,
Ron

XL2002, WinXP-Pro


"Dave" wrote:

Hi,

Can someone tell me what the pros and cons are (if any) of these 2 ways
of naming a range.

ActiveWorkbook.Names.Add NAME:="HOME", RefersTo:=ActiveCell
Range("HOME").Select

or

Dim HOME As Range
Set HOME = ActiveCell
HOME.Select

Thanks,

DaveU


  #3   Report Post  
Posted to microsoft.public.excel.newusers
Dave
 
Posts: n/a
Default Named Reference

Ron, that's a good explanation. I did have a vague idea that the 2nd
way was better (the code seemed "neater") but couldn't quite say why it
was so.

Thanks a lot

DaveU

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
Maintaining cell reference after sorting GRITS Excel Discussion (Misc queries) 2 April 30th 23 07:42 PM
Changing named range reference depending on a cell's content cparaske Excel Discussion (Misc queries) 1 July 29th 05 07:06 PM
Using a formula to create named range reference [email protected] Excel Worksheet Functions 4 June 29th 05 08:03 PM
How to dynamically reference a dynamic named range paris3 Excel Worksheet Functions 4 June 24th 05 01:22 AM
3 cells are named - how to refere to them in one reference field in a chart Marie J-son Charts and Charting in Excel 2 December 2nd 04 04:52 PM


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

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"