Runtime error 1004

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

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
 
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?
 
Back
Top