Excel cell values into an array
Guys
I have a spreadsheet with a column of data (dates, to be exact) that could potentially change. I have some code which does what I want to do very well except the current values in the column are hard-coded into an array, thus:
VB Code:
myArray = Array("01/10/2003", "01/11/2003", "01/12/2003", "01/01/2004", "01/02/2004", "01/03/2004", "01/04/2004", "01/05/2004", "01/06/2004", "01/07/2004", "01/08/2004", "01/09/2004", "01/10/2004", "01/11/2004", "01/12/2004", "01/01/2005")
As these dates may change or indeed be added to, I want to be able to dynamically build the array. I've tried the following, to no avail:
VB Code:
Do Until x = intRows
ActiveSheet.Cells(x, 7).Activate
If strarray = "" Then
strarray = ActiveSheet.Cells(x, 7) & Chr(34)
Else
strarray = strarray & "," & Chr(34) & ActiveSheet.Cells(x, 7) & Chr(34)
End If
x = x + 1
Loop
' MsgBox strarray
intlength = Len(strarray) - 1
strarray = Left(strarray, intlength)
myArray = Array(strarray)
The problem seems to be that although strarray builds up and contains all the correct data, myArray is never populated. I'm pretty sure I'm doing something stupid but I'm just not sure what.
Cheers