Excel VisualBasic Script

Sub BuildNameFromRange()
  Dim rng As Range
  Set rng = ActiveWorkbook.Sheets("sheet1").[A1].CurrentRegion
  ActiveWorkbook.Names.Add Name:="NameArea", RefersTo:="=" + rng.Address(External:=True)
  Debug.Print Range("NameArea").Address(External:=True)
End Sub