View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Named range into an array

Try:

Sub gsnu()
Dim r As Range
Dim v(10)
i = 1
For Each r In Range("xyz")
v(i) = r.Value
i = i + 1
If i = 6 Then Exit For
Next

End Sub

as coded it picks up the first 5 values in "xyz" and does not examine
Range("xyz").Count to get the full range.


Note that Range("xyz") is the equivalent of Range("A1:A5"). A Name is just
a string.

--
Gary''s Student


"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.