moron All American 34144 Posts user info edit post |
I'm trying to use the Find() function in Visual Basic for an Excel macro, and I can't figure out how to detect whether the find was successful or not.
Set FoundCells = inventoryRange.Find(searchKey, LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False)
The line of code and formant for the Find looks like that.
If it finds nothing, the FoundCells, according to the variable watcher, is the value of "Nothing" but I can't seem to figure out how to test for this in visual basic. I've tried FoundCells=null , FoundCells="" , FoundCells.value="" , FoundCells.value="nothing" . Visual Basic will throw an error if a value is nothing and you try to do anything with it, and I could exploit this, but it seems like they'd have a built-in way to test for null in this scenario. Does anyone happen to know of a way?9/27/2007 2:30:52 AM |
moron All American 34144 Posts user info edit post |
LimpyNuts, FTW!
I didn't realize that VB has a difference between = and "is". Thanks a lot man... that's been driving me crazy. I searched a ton of stuff online, and I guess I must have overlooked that distinction, since i'm not use to looking for it. 9/27/2007 12:28:49 PM |