G
Guest
Need some ideas on how to do this correctly as I'm failing to figure it out.
I have selected a range of cells in a column (using VBA) and want to store
the value in each to a string array.
Set r = Range("Tardy5") 'Tarydy5 is name for range F6:F36
r.Select
n = r.Rows.Count
ReDim arrTardy5Cells(n)
'Loop through selected cells.
'Set curCell = r.Cells(1, i) moved out of the loop below to test.
For i = 1 To n
arrTardy5Cells(i) = ActiveCell.Value 'store value to array
ActiveCell(i, 0).Activate 'expect active cell to advance
down one cell
Next i
The above loop does not behave as I expected it to, so need to know what I'm
missing. Thanks!
I have selected a range of cells in a column (using VBA) and want to store
the value in each to a string array.
Set r = Range("Tardy5") 'Tarydy5 is name for range F6:F36
r.Select
n = r.Rows.Count
ReDim arrTardy5Cells(n)
'Loop through selected cells.
'Set curCell = r.Cells(1, i) moved out of the loop below to test.
For i = 1 To n
arrTardy5Cells(i) = ActiveCell.Value 'store value to array
ActiveCell(i, 0).Activate 'expect active cell to advance
down one cell
Next i
The above loop does not behave as I expected it to, so need to know what I'm
missing. Thanks!