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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top