View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
J.E. McGimpsey J.E. McGimpsey is offline
external usenet poster
 
Posts: 493
Default 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