ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert a Range name (https://www.excelbanter.com/excel-programming/287884-insert-range-name.html)

pete

Insert a Range name
 
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

Jim Rech

Insert a Range name
 
ActiveCell.Name = "abc"

--
Jim Rech
Excel MVP




All times are GMT +1. The time now is 11:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com