ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   defining a range of cells in excel using cell content (https://www.excelbanter.com/excel-programming/341462-defining-range-cells-excel-using-cell-content.html)

[email protected]

defining a range of cells in excel using cell content
 
I am attempting to create a macro that will allow me to define a range
of cells, with the "name" for said range of cells coming from the
content of a cell. Rather than manually entering the name of the range
of cells using the insertnamedefine function, I am hoping to create a
macro that automatically selects a cell's content as the name for said
range. Any insight would be most appreciated. Thanks


Rowan Drummond[_3_]

defining a range of cells in excel using cell content
 
This takes the value in cell A1 and uses that as the name for D1:D10 on
sheet1.

Dim theName As String
theName = Cells(1).Value
ActiveWorkbook.Names.Add Name:=theName, RefersToR1C1:= _
"=Sheet1!R1C4:R10C4"

Hope this helps
Rowan

wrote:
I am attempting to create a macro that will allow me to define a range
of cells, with the "name" for said range of cells coming from the
content of a cell. Rather than manually entering the name of the range
of cells using the insertnamedefine function, I am hoping to create a
macro that automatically selects a cell's content as the name for said
range. Any insight would be most appreciated. Thanks



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

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