Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Named range in an array

Hi,

I have five cells on a row (A1:A5). This range is named "xyz".
How can I transform this range in an array with VB code?

Thank you.
Paolo.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Named range in an array

dim v as Variant
v = Range("xyz").Value

for i = 1 to 5
msgbox v(i,1)
Next


If you want a 1D array

v = application.Transpose("xyz")

for i = 1 to 5
msgbox v(i)
Next

--
Regards,
Tom Ogilvy


"Frigster" wrote:

Hi,

I have five cells on a row (A1:A5). This range is named "xyz".
How can I transform this range in an array with VB code?

Thank you.
Paolo.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 200
Default Named range in an array

Tom Ogilvy wrote:
dim v as Variant
v = Range("xyz").Value

for i = 1 to 5
msgbox v(i,1)
Next


If you want a 1D array

v = application.Transpose("xyz")'<---A typo:v = application.Transpose(Range("xyz"))

for i = 1 to 5
msgbox v(i)
Next

Alan Beban
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Named range in an array

Sorry, I think there is again a typo ...

If you want a 1D array
v = application.WorkSheetFunction.Transpose(Range("xyz "))

Christian CROCHE
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Named range in an array

No, there is no requirement to use WorksheetFunction. No typo.

--
Regards,
Tom Ogilvy


"ccroche" wrote in message
...
Sorry, I think there is again a typo ...

If you want a 1D array
v = application.WorkSheetFunction.Transpose(Range("xyz "))

Christian CROCHE





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Named range in an array

One way:

Dim arr As Variant
arr = Range("A1:A5").Value


In article ,
"Frigster" wrote:

Hi,

I have five cells on a row (A1:A5). This range is named "xyz".
How can I transform this range in an array with VB code?

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
Using Named Range within an Array Formula Ivor Davies Excel Discussion (Misc queries) 2 August 25th 09 11:15 AM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
Named range into an array Frigster Excel Worksheet Functions 2 September 6th 06 07:08 PM
Array to named range conversion... i-Zapp Excel Discussion (Misc queries) 4 October 25th 05 09:09 PM
Defined named range to array MattShoreson[_2_] Excel Programming 1 December 4th 03 10:06 AM


All times are GMT +1. The time now is 07:23 AM.

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

About Us

"It's about Microsoft Excel"