ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Runtime error 1004 (https://www.excelbanter.com/excel-programming/279218-runtime-error-1004-a.html)

Gary[_4_]

Runtime error 1004
 
Hi,

i am using MSAccess and trying to build an Excel sheet

i am using range method to put some values which i get at runtime

i am getting an error - Run time Error '1004'

Method 'Range'of object '_Worksheet' failed

this is the sample code i am using

xlSht.Range("A" & Val(lngrow + 26)).Value = rst!COLRNM

this line is actually in a loop, and executes fine a few times but raises
this error intermittently.

Please help

Gary



J.E. McGimpsey

Runtime error 1004
 
What's the value of lngrow when you get the error? Of what type is
lngrow? If lngrow is of type long, then calling VAL() is unnecessary
- just use lngrow + 26.

Is xlSht always a worksheet? Or might it be a chart sheet?



In article ,
"Gary" wrote:

Hi,

i am using MSAccess and trying to build an Excel sheet

i am using range method to put some values which i get at runtime

i am getting an error - Run time Error '1004'

Method 'Range'of object '_Worksheet' failed

this is the sample code i am using

xlSht.Range("A" & Val(lngrow + 26)).Value = rst!COLRNM

this line is actually in a loop, and executes fine a few times but raises
this error intermittently.

Please help

Gary




All times are GMT +1. The time now is 01:16 AM.

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