ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying an array to a worksheet: Excel 97 vs 2000 (https://www.excelbanter.com/excel-programming/291541-copying-array-worksheet-excel-97-vs-2000-a.html)

Trevor Shuttleworth

Copying an array to a worksheet: Excel 97 vs 2000
 
Dear all

I am accumulating monthly totals in a an array defined as:

Dim MonthTotal(1 To 12) As Variant

The following single line of code works in Excel 2000:

SheetCell.Offset(0, 1).Resize(, 12) = MonthTotal

But, in Excel 97 at work, for some reason it creates text values with $
signs (followed by a space)
So, instead, I've had to resort to this:

For i = 1 To 12
SheetCell.Offset(0, i) = MonthTotal(i)
Next 'i

It's not a problem as such as I've found a workaround. However, I would
like to understand what, if anything, I'm doing wrong ... or is this a
difference between Excel 97 and Excel 2000 ?

Regards

Trevor



Dave Peterson[_3_]

Copying an array to a worksheet: Excel 97 vs 2000
 
Just a guess--I don't have xl97 anymo

SheetCell.Offset(0, 1).Resize(, 12).Value = MonthTotal

(but it won't take too long to find out if it worked.)

Trevor Shuttleworth wrote:

Dear all

I am accumulating monthly totals in a an array defined as:

Dim MonthTotal(1 To 12) As Variant

The following single line of code works in Excel 2000:

SheetCell.Offset(0, 1).Resize(, 12) = MonthTotal

But, in Excel 97 at work, for some reason it creates text values with $
signs (followed by a space)
So, instead, I've had to resort to this:

For i = 1 To 12
SheetCell.Offset(0, i) = MonthTotal(i)
Next 'i

It's not a problem as such as I've found a workaround. However, I would
like to understand what, if anything, I'm doing wrong ... or is this a
difference between Excel 97 and Excel 2000 ?

Regards

Trevor


--

Dave Peterson



All times are GMT +1. The time now is 07:25 PM.

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