Array Question

Lintz
09-06-2003, 08:23 PM
I'm using values in Excel to plot on a MSChart. My problem is the last row of the range will vary on a daily basis so I need the arrPortfolio array to reflect the new range. I find the last row (LastCompletedRow) but it won't except it when declaring arrPortfolio. How can I get around this so the arrPortfolio array will except the LastCompleteRow ?

Dim arrPortfolio(1 To LastCompletedRow)
Dim i As Integer

For i = 1 To LastCompletedRow
arrPortfolio(i) = objExcel.Worksheets(2)
.Range("AD" & i + 1).Value
Next i

MSChart1.ChartData = arrPortfolio
MSChart1.chartType = VtChChartType2dLine

lebb
09-06-2003, 08:27 PM
Dim it as just arrPorfolio() to begin, then when LastCompletedRow has been assigned a value, redimension the array with ReDim.

Lintz
09-06-2003, 08:37 PM
Thanks lebb, that worked like a charm :D

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum