Stumped on Object Variable not set

S

salgud

The following is a snippet of code from my prgram:

If vRsnCode <> Empty Then
Select Case rCell
'Contact Code is Office Visit
Case Is = "G"
Select Case vRsnCode
'Reason Code for Complaint
Case Is = "3"
ws.Cells(iMoRow, iSpecWtRefCol + 1) = _
ws.Cells(iMoRow, iSpecWtRefCol + 1) + iComplCON

'Reason code for State II
Case Is = "7"
ws.Cells(iMoRow, iSpecWtRefCol + 2) = _
ws.Cells(iMoRow, iSpecWtRefCol + 2) + iSIICON

Case Else
GoTo errh

End Select

Case Is = "A"
Select Case vRsnCode
'Reason Code for Telephone Call
Case Is = "16"
ERROR ---------> ws.Cells(iMoRow, iSpecWtRefCol + 3) = _
ws.Cells(iMoRow, iSpecWtRefCol + 3) + iTCCIRCON


'error trapping when Reason Code (vRsnCode) is not a
valid value
Case Else
errh:

MsgBox "Error" '### To be replaced with error trapping
code ###
End Select
End Select
End If


I'm getting an Object variable not set error on the marked line. That line
is nearly an exact duplicate of lines above, the only different being the
offset value and the constant, iTTCCIRCON. The constant is set as such and
shows the correct value (15) when in run mode, as do all the varibles in
that line.

Anyone see what I can't?

Thanks in advance.
 
S

salgud

The following is a snippet of code from my prgram:

If vRsnCode <> Empty Then
Select Case rCell
'Contact Code is Office Visit
Case Is = "G"
Select Case vRsnCode
'Reason Code for Complaint
Case Is = "3"
ws.Cells(iMoRow, iSpecWtRefCol + 1) = _
ws.Cells(iMoRow, iSpecWtRefCol + 1) + iComplCON

'Reason code for State II
Case Is = "7"
ws.Cells(iMoRow, iSpecWtRefCol + 2) = _
ws.Cells(iMoRow, iSpecWtRefCol + 2) + iSIICON

Case Else
GoTo errh

End Select

Case Is = "A"
Select Case vRsnCode
'Reason Code for Telephone Call
Case Is = "16"
ERROR ---------> ws.Cells(iMoRow, iSpecWtRefCol + 3) = _
ws.Cells(iMoRow, iSpecWtRefCol + 3) + iTCCIRCON


'error trapping when Reason Code (vRsnCode) is not a
valid value
Case Else
errh:

MsgBox "Error" '### To be replaced with error trapping
code ###
End Select
End Select
End If


I'm getting an Object variable not set error on the marked line. That line
is nearly an exact duplicate of lines above, the only different being the
offset value and the constant, iTTCCIRCON. The constant is set as such and
shows the correct value (15) when in run mode, as do all the varibles in
that line.

Anyone see what I can't?

Thanks in advance.

Should have mentioned there is another problem. The values are not showing
in the appropriate cells. Anyone know why?

Thanks.
 
S

salgud

Should have mentioned there is another problem. The values are not showing
in the appropriate cells. Anyone know why?

Thanks.

Testing this code, I found something strange. I remarked out the entire
last Select Case section (the one where the error was occurring), from
"Case Is "A"" down to "End Select" and ran the program. Got the Object not
defined error on the line after "Case is 7". (Line ending with iSSIICON) So
the error is on the last occurrence of this statement. What does that tell
us?
 
D

Dave Peterson

Where is ws set to something?
The following is a snippet of code from my prgram:

If vRsnCode <> Empty Then
Select Case rCell
'Contact Code is Office Visit
Case Is = "G"
Select Case vRsnCode
'Reason Code for Complaint
Case Is = "3"
ws.Cells(iMoRow, iSpecWtRefCol + 1) = _
ws.Cells(iMoRow, iSpecWtRefCol + 1) + iComplCON

'Reason code for State II
Case Is = "7"
ws.Cells(iMoRow, iSpecWtRefCol + 2) = _
ws.Cells(iMoRow, iSpecWtRefCol + 2) + iSIICON

Case Else
GoTo errh

End Select

Case Is = "A"
Select Case vRsnCode
'Reason Code for Telephone Call
Case Is = "16"
ERROR ---------> ws.Cells(iMoRow, iSpecWtRefCol + 3) = _
ws.Cells(iMoRow, iSpecWtRefCol + 3) + iTCCIRCON


'error trapping when Reason Code (vRsnCode) is not a
valid value
Case Else
errh:

MsgBox "Error" '### To be replaced with error trapping
code ###
End Select
End Select
End If

I'm getting an Object variable not set error on the marked line. That line
is nearly an exact duplicate of lines above, the only different being the
offset value and the constant, iTTCCIRCON. The constant is set as such and
shows the correct value (15) when in run mode, as do all the varibles in
that line.

Anyone see what I can't?

Thanks in advance.
 

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