ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Named Ranges in VBA (https://www.excelbanter.com/excel-discussion-misc-queries/31055-named-ranges-vba.html)

Bruce

Named Ranges in VBA
 
I need to know how to name a range using VBA. The example as follows does not work.
Selection.Name = "Named Range".
What is the correct syntax for this?

Dave Peterson

The syntax is correct. Then Name isn't valid (contains a space).

This worked ok for me:

Selection.Name = "Named_Range"



Bruce wrote:

I need to know how to name a range using VBA. The example as follows
does not work.
Selection.Name = "Named Range".
What is the correct syntax for this?

--
Bruce


--

Dave Peterson


All times are GMT +1. The time now is 05:13 PM.

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