Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Stumped on Object Variable not set

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Stumped on Object Variable not set

On Fri, 12 Mar 2010 09:17:20 -0700, salgud wrote:

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.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Stumped on Object Variable not set

Are you sure iMoRow is not 0?

--

HTH

Bob

"salgud" wrote in message
...
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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Stumped on Object Variable not set

On Fri, 12 Mar 2010 17:09:35 -0000, Bob Phillips wrote:

Are you sure iMoRow is not 0?


Thanks for your reply. I checked it again, just to be sure. It is 7, which
is the correct value.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Stumped on Object Variable not set

On Fri, 12 Mar 2010 09:24:24 -0700, salgud wrote:

On Fri, 12 Mar 2010 09:17:20 -0700, salgud wrote:

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.


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?


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Stumped on Object Variable not set

Where is ws set to something?

salgud wrote:

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.


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Stumped on Object Variable not set

On Fri, 12 Mar 2010 13:07:25 -0600, Dave Peterson wrote:

Where is ws set to something?

Doh! I checked for a declaration, but not a set. It's all good now. Thanks!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
Object Variable Not Set Error on Selection object Jean Excel Worksheet Functions 3 July 24th 06 06:45 PM
Stumped by "Object variable not set" again davegb Excel Programming 3 January 25th 06 05:05 PM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


All times are GMT +1. The time now is 04:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"