LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default code to add a name to the names collection and assign a reference

The first instance add the name MyNameRange to range A1 to E5, if you need
to do this under program control it might be easier to use the second
version that specifies the row and column numbers (also range A1 to
E5)....., prefix the Range with Worksheets("MySheet") if it is not on the
active sheet.


ActiveWorkbook.Names.Add Name:="MyNameRange", _
RefersTo:=Range("A1:E5")


ActiveWorkbook.Names.Add Name:="MyNameRange", _
RefersTo:=Range(Cells(1, 5), Cells(5, 5))

--
Cheers
Nigel



"keithb" wrote in message
...
Can someone give me an example showing code to add a name to the names
collection and to assign the name to a range reference such as,
"mynamesfile.xls!customername"

Thanks,

Keith




 
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
assign file numbers to names NeSchw6G Excel Discussion (Misc queries) 2 December 14th 07 04:23 PM
Assign charts names in VBA? PaulW Excel Discussion (Misc queries) 4 May 11th 06 01:13 PM
Assign names to R1C1 referencing Art Excel Programming 10 May 2nd 04 04:46 PM
Adding Range to Worksheet Names Collection Keith Willshaw Excel Programming 2 March 5th 04 09:17 AM
Names Collection MarkC[_2_] Excel Programming 2 January 28th 04 10:47 AM


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