ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Named ranges (https://www.excelbanter.com/excel-programming/329053-named-ranges.html)

Steve C

Named ranges
 
I have text in cell A1. In B1, I want to create a named range = text in A1.
How would I write the code for that? Thanks.

Steve C

Vasant Nanavati

Named ranges
 
Range("B1").Name = Range("A1")

--

Vasant

"Steve C" wrote in message
...
I have text in cell A1. In B1, I want to create a named range = text in

A1.
How would I write the code for that? Thanks.

Steve C




Nick Hodge

Named ranges
 
Steve

Try something like this

Sub SetRngName()
ThisWorkbook.Names.Add Name:=Range("A1").Value, _
RefersTo:="=Sheet1!$B$1"
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS

"Steve C" wrote in message
...
I have text in cell A1. In B1, I want to create a named range = text in
A1.
How would I write the code for that? Thanks.

Steve C




Steve C

Named ranges
 
Thanks! That works great!

"Vasant Nanavati" wrote:

Range("B1").Name = Range("A1")

--

Vasant

"Steve C" wrote in message
...
I have text in cell A1. In B1, I want to create a named range = text in

A1.
How would I write the code for that? Thanks.

Steve C






All times are GMT +1. The time now is 09:25 AM.

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