Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
VBA newbie here. I haven't done my homework fully yet so I am not asking for the complete answer, rather some help to jump start my thinking process. What I need to do is come up with a code that will read the value (it's an integer) from cells in one column i.e. column A. The start value is in cell A14 and then it appears in every 2nd consecutive cell down from A14. For example, A14 contains 1, then A16 contains 2, A18 contains 3 and so on...so I'd like to read all the values in an array, then stop when the cells are empty. How can I get around this? Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Try this: Sub ValToArr() Dim MyArray Set StartCell = Range("A14") Set EndCell = Range("A" & Rows.Count).End(xlUp) rowCount = EndCell.Row - StartCell.Row ReDim MyArray(rowCount / 2 + 1) For r = StartCell.Row To EndCell.Row Step 2 i = i + 1 MyArray(i) = Cells(r, "A").Value Next End Sub Regards, Per On 26 Jan., 22:55, Varun wrote: Hi All, VBA newbie here. *I haven't done my homework fully yet so I am not asking for the complete answer, rather some help to jump start my thinking process. What I need to do is come up with a code that will read the value (it's an integer) from cells in one column i.e. column A. The start value is in cell A14 and then it appears in every 2nd consecutive cell down from A14. *For example, A14 contains 1, then A16 contains 2, A18 contains 3 and so on...so I'd like to read all the values in an array, then stop when the cells are empty. How can I get around this? *Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Putting column values in multiple rows | Excel Programming | |||
Populate a column by extracting unique values from another column? | Excel Worksheet Functions | |||
putting values into cells is slow | Excel Programming | |||
Putting correct values in cells | Excel Programming | |||
putting ' in a column of cells | Excel Programming |