Add the name to the Names collection associated with the worksheet, which only includes the names that are local to that worksheet : Name Create « Excel « VBA / Excel / Access / Word

Home
VBA / Excel / Access / Word
1.Access
2.Application
3.Data Type
4.Data Type Functions
5.Date Functions
6.Excel
7.File Path
8.Forms
9.Language Basics
10.Math Functions
11.Outlook
12.PowerPoint
13.String Functions
14.Windows API
15.Word
16.XML
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
VBA / Excel / Access / Word » Excel » Name Create 
Add the name to the Names collection associated with the worksheet, which only includes the names that are local to that worksheet
 
Sub nameRef()
     Worksheets("Sheet1").Names.add name:="Costs", RefersTo:="=Sheet1!$F$10:$F$12"
End Sub
'Using the Name Property of the Range Object
Sub name()
     range("A1:D10").name = "SalesData"
End Sub

 
Related examples in the same category
1.create a global name that refers to a range using the Add method of the Workbook object's Names collection
2.Create a local name
3.renames an existing name:
4.Create a name based on a Range
5.Define a name by referring a workbook
6.Define a name by referring the selection cell address
java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.