Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Named range into 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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Named range into an array
?????
Dim arr(1 to 5) arr = Range("xyz") Alan Beban Gary''s Student wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Picking out column in named range | Excel Worksheet Functions | |||
Named range causing really weird problems - HELP | Excel Discussion (Misc queries) | |||
Array Formula Not Working with Range with Formulas | Excel Discussion (Misc queries) | |||
Pivot Tables - Named Range | Excel Worksheet Functions | |||
Define a range based on another named range | Excel Worksheet Functions |