Applies To
Range Object.
Description
Creates names in the given range based on text labels in the sheet.
Syntax
object.CreateNames(top, left, bottom, right)
object
Required. Create names in this range.
top
Optional. Corresponds to the Top Row check box in the Create dialog box. Can be True or False.
left
Optional. Corresponds to the Left Column check box in the Create dialog box. Can be True or False.
bottom
Optional. Corresponds to the Bottom Row check box in the Create dialog box. Can be True or False.
right
Optional. Corresponds to the Right Column check box in the Create dialog box. Can be True or False.
Remarks
If you do not specify one of top, left, bottom, or right, Microsoft Excel guesses the location of the text labels based on the shape of the specified range.
See Also
Add Method (Names Collection), Delete Method.
Example
This example creates names for cells B1:B3 based on the text in cells A1:A3. Note that you must include the cells that contain the names in the range, even though the names are created only for cells B1:B3.
Set rangeToName = Worksheets("Sheet1").Range("A1:B3") rangeToName.CreateNames left:=True