Runtime error 1004

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
 
J

J.E. McGimpsey

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top