View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
patrick molloy patrick molloy is offline
external usenet poster
 
Posts: 391
Default Assigning values from a selected range to individual variables

You don't need to make it so complex. You can load a
variant directly from a range

eg
1)
DIM MyArray as Variant
MyArray = Range("G1:Y34")

2)
DIM MyArray as Variant
MyArray = Selection

You can easily find the bounds using the UBOUND ad LBOUND
functions.

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
sorry, I forgot...

to have a more flexible solution :

If you want to be able to handle multicolumn selection :
1. remove the if block checking the number of columns
2. make a multidimensional ReDim. The second dimension

should set the
number of columns in the selection.
3. change the loop, so you can peek the selected range

through columns


---
Message posted from http://www.ExcelForum.com/

.