Error Method Cell of object global failure

M

Marilyn

I'm experiencing this error (Method - 'Cell ' of object -
Global failure) after running through the routine twice.
On the first run, this error is not encountered.

This code is run from Access 2000:
HeadingArr = Array("Negotiated Current","Actual Current", _
"Negotiated ITD", "Actual ITD")

For i = 2 to 11 Step 3
Set oRange = oSheet.Range(Cells(1,i), Cells(1, i + 2))
With oRange
.MergeCell = True
.Value = HeadingArr(Init((i+1) 3))
end with
next
 
R

Rob Bovey

Hi Marilyn,

The only thing that jumps out immediately is that you might be doing
something that activates a different worksheet than the one your oSheet
variable refers to in between runs. In this case, the oSheet.Range and the
unqualified Cells method are referring to ranges on two different
worksheets. Try it like this and see if it fixes the problem:

Set oRange = oSheet.Range(oSheet.Cells(1,i), oSheet.Cells(1, i + 2))

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
 

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