Insert a Range name

  • Thread starter Thread starter Pete
  • Start date Start date
P

Pete

Can anyone tell me how to insert a range name using code.
What I am tring to do is find a cell then activate that
cell to call it by name for future use in my macro.

here what I am tring.

Cells.Find(What:="Cad Totals:", After:=ActiveCell,
LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=False).Activate
ActiveCell.Names.Add Name:="CadT"

Cells.Find(What:="Totals in usd:", After:=ActiveCell,
LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=False).Activate
ActiveCell.Range("A1:D1").Select
ActiveWorkbook.Names.Add Name:="USTotal"

thanks
Pete
 
Back
Top