Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Load selection into an Array - VBA
How do I take a selection of cells on the sheet and load them into an
Array in VBA? -Steve |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Load selection into an Array - VBA
Dim arr
arr = Range(Cells(1), Cells(10, 10)) RBS "brittonsm" wrote in message ... How do I take a selection of cells on the sheet and load them into an Array in VBA? -Steve |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Load selection into an Array - VBA
One way:
Dim vArr As Variant vArr = Range("A1:J10").Value which loads the values in the range into a (1 To 10, 1 to 10) variant array. In article , brittonsm wrote: How do I take a selection of cells on the sheet and load them into an Array in VBA? -Steve |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Load selection into an Array - VBA
brittonsm wrote:
How do I take a selection of cells on the sheet and load them into an Array in VBA? -Steve You've received two valid answers for a Variant() array or an array contained within a Variant variable. If that is not your situation, post back. Alan Beban |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Load selection into an Array - VBA
In the worst case, if your selection is a pile on non-contiguous cells, then:
Sub sel_to_array() Dim ar() As Variant ReDim ar(1 To Selection.Count) As Variant i = 1 For Each r In Selection ar(i) = r.Value i = i + 1 Next End Sub -- Gary''s Student - gsnu2007j "brittonsm" wrote: How do I take a selection of cells on the sheet and load them into an Array in VBA? -Steve |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
listbox selection to load to new form | Excel Programming | |||
How do you dynamically load an array? | Excel Programming | |||
Load UserForm1 on sheet tab selection | Excel Programming | |||
Load an array with Sheet names | Excel Programming |