ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   inputing data into dynamic arrays (https://www.excelbanter.com/excel-programming/292712-inputing-data-into-dynamic-arrays.html)

margie[_7_]

inputing data into dynamic arrays
 
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

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


Bob Phillips[_6_]

inputing data into dynamic arrays
 
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)

"margie " wrote in message
...
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 excel
worksheet and store it into an array. The amount of data the user
inputs varies from day to day. So for example, a user will input
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 may
be 20 order numbers and so on. How do I write a function that will
read those inputs and store them into an array?


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




margie[_8_]

inputing data into dynamic arrays
 
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

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


Alan Beban[_4_]

inputing data into dynamic arrays
 
Dim rng As Range, arr() As Variant
Set rng = Range("A1").Resize(Application.CountA(Range("A1:A6 5336")))
arr = rng.Value

Alan Beban

margie < wrote:
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 an
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 stored
in the array until it's put into the worksheet. How do I write this in
VB so that it stores the values in an array.


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




All times are GMT +1. The time now is 04:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com