excel vba moving non-contiguous range selection to an array
        Posted  
        
            by 
                Russ Urquhart
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Russ Urquhart
        
        
        
        Published on 2012-09-21T21:16:25Z
        Indexed on 
            2012/09/21
            21:39 UTC
        
        
        Read the original article
        Hit count: 535
        
In the situation where the user select two non-contiguous column ranges i wrote the following:
Dim count long
Dim points variant
Dim i long
Set user_range = ActiveWindow.RangeSelection
count = user_range.count / 2
ReDim points(1 To count, 1 To 2)
For i = 1 To count
    MsgBox "value is" & user_range.Areas.Item(1).Value(i,1)
    points(i, 1) = user_range.Areas.Item(1).Value(i,1)
    points(i, 2) = user_range.Areas.Item(2).Value(i,1)
Next i
But i get an object error when i try this. Am i indexing Value wrong?
This should work right? Is there an easier way to do this?
Any help is greatly appreciated!
Thanks,
Russ
© Stack Overflow or respective owner