Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Convert Worksheet List to Named Array Constant

Rick,

Thank you. That's exactly what I was looking for.

--
Steph


"Rick Rothstein" wrote:

I think this does what you want...

Sub CreateNameArray()
Dim X As Long
Dim R As Range
Dim N As String
Set R = Worksheets("Sheet4").Range("A1:A3")
N = "={"
For X = 1 To R.Count
N = N & """" & R(X).Value & ""","
Next
N = Left(N, Len(N) - 1) & "}"
Names.Add Name:="Months", RefersTo:=N
End Sub

--
Rick (MVP - Excel)


"Steph" wrote in message
...
I have a list on a worksheet. I would like to convert that list to a named
range. Is there a VBA procedure that would do so?

For example, in cells A1:A3 I have

A1 - Jan
A2 - Feb
A3 - Mar

I would like to convert this list to a defined name called "Months". The
defined name dialog box "refers to" input for the name "Months" would look
like:

={"Jan","Feb","Mar"}

Thanks for your help.

--
Steph



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
populate array with list of named range LetMeDoIt Excel Programming 5 May 1st 08 11:36 PM
Data validation list / named array constant Werner Rohrmoser Excel Worksheet Functions 3 March 19th 08 12:23 PM
Named Constant Shatin[_2_] Excel Programming 5 March 10th 08 07:08 PM
Defined named range (Array list) Sinner Excel Programming 2 February 16th 08 02:17 PM
Search and replace using a named array on another worksheet Tom Ogilvy Excel Programming 1 August 10th 07 02:06 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"