LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default How can I detect "nothing"?

Seems to be much ado about Nothing! lol

"plh" wrote:

This takes a little explaining, please bear with me:
As part of a data mining project I have Excel (2003) VBA code that builds a list
out of a user defined variable type:

Type OpRec
.........
........
........
[List of variable eliminated to save space]
End Type

Type SORec
strSOSfx As String
strPItem As String
OpRecord() As OpRec
End Type
Dim sO() As SORec

Because a few of the lines in the file this reads result from erroneous or
canceled shop orders, when the process reaches those lines, I try to skip over
them:

If (UBound(sO(i).OpRecord) < 0) Then
This works OK for many but a few end up with "Subscript out of range". At such
times watches tell me that sO(i).OpRecord = Nothing.

I tried
If (UBound(sO(i).OpRecord) < 0) And (sO(i).OpRecord < Nothing) Then
And got "Invalid use of Object"

I tried
Dim varNothing
Set varNothing = Nothing
If (UBound(sO(i).OpRecord) < 0) And (sO(i).OpRecord < varNothing) Then
And got "Type Mismatch"

I tried
If (UBound(sO(i).OpRecord) < 0) And Not IsNull(sO(i).OpRecord) Then
but got the message "Only user defined types defined in public object modules
can be coerced to or from a variant passed to late-bound functions"

This last one goes over my head. How do I set up a public object module (what
sources of info can I you recommend) and even if I do that, will it work? Or is
there a simpler way?
(There are many thousands of lines in the input file, so manual editing is not
an option!)
Thank You,
-plh


--
I keep hitting "Esc" -- but I'm still here!



 
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
problem getting "detect and repair" to work in Excel 2003 ms Excel Discussion (Misc queries) 4 February 4th 10 02:39 AM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 11:49 PM.

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"