Define a name by referring a workbook : Name Create « Excel « VBA / Excel / Access / Word






Define a name by referring a workbook

 
Sub DefineName3()
  ActiveWorkbook.names.Add Name:="WorkArea", RefersTo:="=" + ActiveWorkbook.Sheets("sheet1").[A1].CurrentRegion.Address(External:=True)
  Debug.Print Range("WorkArea").Address(External:=True)
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.Add the name to the Names collection associated with the worksheet, which only includes the names that are local to that worksheet
6.Define a name by referring the selection cell address