View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Wilson John Wilson is offline
external usenet poster
 
Posts: 550
Default Creating range name for a range selection

Mervyn,

Try this out:

Range("A1").CurrentRegion.Name = "TestRange"

John

"Mervyn Thomas" wrote in message
...
My existing code is a bit predetermined as in the example:

ActiveWorkbook.Names.Add Name:="CodeLookup",
RefersToR1C1:="=CostCodes!R1C2:R200C8"

I can't figure out how to change this to refer to the current region
selection such as:

ActiveWorkbook.Names.Add Name:="CodeLookup", RefersToR1C1;= current
selection

Mervyn