View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
מיכאל (מיקי) אבידן מיכאל (מיקי) אבידן is offline
external usenet poster
 
Posts: 561
Default Set values in an Array

Try the hereunder code.
The 2 Message Boxes prove that the 12 values are kept, each' in the
respective cell.
=====================
Sub Fill_One_Dimensional_Array()
Dim Rng As Range
Arr = Range("A1:A12")
MsgBox Arr(3, 1)
MsgBox Arr(5, 1)
End Sub
================
To make the list dynamically - check for the last filled cell in column "A":
LR = Cells(Rows.Count ,1).End(xlUP).Row
then use LR in the Array filling command:
Arr = Range("A1:A" & LR)
Micky


"jlclyde" wrote:

Is there a way to load an array with data from a worksheet? Here is
the code I have.

ActiveSheet.ListObjects("List12559").Range.AutoFil ter Field:=1,
Criteria1:= _
Array("103", "113", "123", "213", "220", "227", "231", "235",
"290", "500", _
"540", "900"), Operator:=xlFilterValues

These values are in A1-A12. I am hoping to make this more dynamic so
when I add a criteria I can just add it to the sheet and not to the
sheet and the VBA macro.

Any help woudl be appreciated,
Jay
.