ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 2000 : Error 1004 (https://www.excelbanter.com/excel-programming/333045-excel-2000-error-1004-a.html)

Raj

Excel 2000 : Error 1004
 
I am using an array to fill the data into the Excel sheet.

It works fine for smaller size of arrays ( say 600 X 20) .

But If the data is large , then it gives '1004 : application defined or
object defined error'

The code is something like below.

Dim avsheet3 as Variant
/* some more code */
Redim avSheet3(8500, 14)
/* some more code to fill the array */
sRange = "A1:N8500"
set worksheet = workbook.worksheet(3)
worksheet.Range(sRange).value = avsheet3

It gives the error on the last line.



Tom Ogilvy

Excel 2000 : Error 1004
 
although you example is 8501 x 15 for option base 1, it still worked fine
for me:

Sub ABC()
Dim avsheet3 As Variant
'/* some more code */
ReDim avsheet3(8500, 14)
'/* some more code to fill the array */
For i = 0 To 8500
For j = 0 To 14
avsheet3(i, j) = Chr(j + 65) & i + 1
Next
Next
sRange = "A1:N8500"
Set Worksheet = ThisWorkbook.Worksheets(3)
Worksheet.Range(sRange).Value = avsheet3

End Sub


xl2003

--
Regards,
Tom Ogilvy

"raj" wrote in message
...
I am using an array to fill the data into the Excel sheet.

It works fine for smaller size of arrays ( say 600 X 20) .

But If the data is large , then it gives '1004 : application defined or
object defined error'

The code is something like below.

Dim avsheet3 as Variant
/* some more code */
Redim avSheet3(8500, 14)
/* some more code to fill the array */
sRange = "A1:N8500"
set worksheet = workbook.worksheet(3)
worksheet.Range(sRange).value = avsheet3

It gives the error on the last line.






All times are GMT +1. The time now is 10:05 AM.

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