Run-Time error 40036

N

Nick I

Hi, I am really struggling with this error..."Application defined or object
defined error"

I have some code that runs queries in VBA and dumps numbers into an Excel
sheet.

For some reason, one of the queries I am trying to dump to Excel triggers
this error, right at the line where it dumps data into the cell:

Dim aryData

aryData = objRST.GetRows

ElseIf (SheetName = "Phone Stats") Then

With xlSheet

'If Phone Stats for VP Metrics, we should have 3 columns to fill

.Cells.Range(CellName1) = aryData(0, 0) '<---error is here
.Cells.Range(CellName2) = aryData(1, 0)
.Cells.Range(CellName3) = aryData(2, 0)

End With

I have used this method many times in the past without any problems. In
works in all of the other sheets in my Excel file. In the debug mode, both
CellName1 and the aryData(0,0) are set to the proper values when I move the
mouse over them. aryData is set to "J31" and aryData is a valid number.....

I can't figure it out, can someone help?? Thanks.
 

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