inputing data into dynamic arrays

  • Thread starter Thread starter margie
  • Start date Start date
M

margie

This seems like a really simple thing but I can't seem to figure it out
I need a function that will read data that a user inputs in an exce
worksheet and store it into an array. The amount of data the use
inputs varies from day to day. So for example, a user will inpu
order numbers in column A starting in row 1 and going down the column.
One day there may be a list of 10 order numbers, another day there ma
be 20 order numbers and so on. How do I write a function that wil
read those inputs and store them into an array
 
Margie,

You sat arrays, but talk of rows, so I assume that you mean worksheets.

cLastRow = Cells(Rows.Count,"A").End(xlUp).Row
Cells(cLastRow+1,"A").Value = "whatever"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Maybe I should try to clarify myself. Suppose a user inputs
A
1 red
2 orange
3 yellow
4 green
5 blue

(in a worksheet this is column A rows 1 through 5).

Now I need a function that will read these inputs and store them in a
array. But lets say tomorrow the user inputs 6 colors instead of 5.
The array is dynamic so you don't know how many values will be store
in the array until it's put into the worksheet. How do I write this i
VB so that it stores the values in an array
 
Dim rng As Range, arr() As Variant
Set rng = Range("A1").Resize(Application.CountA(Range("A1:A65336")))
arr = rng.Value

Alan Beban
 
Back
Top