ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 2003. Assign array to range (https://www.excelbanter.com/excel-programming/360330-excel-2003-assign-array-range.html)

Jorge Vinuales

Excel 2003. Assign array to range
 
Hi everyone, and sorry for my english

I have an excel application, developed in Excel XP. In a line of code, I
have this statement:
MyRange.Value = myArray

myArray is a two dimensions array, which has the same number of rows and
columns than the range object I'm trying to assign.

This code runs without problems in XP, but when I try to run it under Excel
2003, I'm getting the error "Application or object defined error".

¿Any suggestion?

thanks



Tom Ogilvy

Excel 2003. Assign array to range
 
Sub AA()
Dim myRange As Range
Dim myarray(1 To 3, 1 To 10) As Long
For i = 1 To 3
For j = 1 To 10
myarray(i, j) = i * j
Next
Next
Set myRange = Range("M10").Resize(1, 10)
myRange.Value = myarray
End Sub

worked fine for me in xl2003.

--
Regards,
Tom Ogilvy


"Jorge Vinuales" wrote:

Hi everyone, and sorry for my english

I have an excel application, developed in Excel XP. In a line of code, I
have this statement:
MyRange.Value = myArray

myArray is a two dimensions array, which has the same number of rows and
columns than the range object I'm trying to assign.

This code runs without problems in XP, but when I try to run it under Excel
2003, I'm getting the error "Application or object defined error".

¿Any suggestion?

thanks




Jorge Vinuales

Excel 2003. Assign array to range
 
Yes, thanks Tom.

I have realized that the problem must be with one of the formulas of the
array.
The values of the array are numbers and sometimes formulas. Some of them are
causing some kind of problem but if I try to write by hand those formulas in
the worksheet, there is no problem with them.

I suppose that my problem could be the language version (spanish)

I'll continue investigating...


"Tom Ogilvy" escribió en el mensaje
...
Sub AA()
Dim myRange As Range
Dim myarray(1 To 3, 1 To 10) As Long
For i = 1 To 3
For j = 1 To 10
myarray(i, j) = i * j
Next
Next
Set myRange = Range("M10").Resize(1, 10)
myRange.Value = myarray
End Sub

worked fine for me in xl2003.

--
Regards,
Tom Ogilvy


"Jorge Vinuales" wrote:

Hi everyone, and sorry for my english

I have an excel application, developed in Excel XP. In a line of code, I
have this statement:
MyRange.Value = myArray

myArray is a two dimensions array, which has the same number of rows and
columns than the range object I'm trying to assign.

This code runs without problems in XP, but when I try to run it under
Excel
2003, I'm getting the error "Application or object defined error".

¿Any suggestion?

thanks







All times are GMT +1. The time now is 01:19 PM.

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