View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default 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