Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / December 2005

Tip: Looking for answers? Try searching our database.

Named Reference

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave - 17 Dec 2005 02:09 GMT
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
Ron Coderre - 17 Dec 2005 04:33 GMT
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

> Hi,
>
[quoted text clipped - 13 lines]
>
> DaveU
Dave - 17 Dec 2005 08:20 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.