test for Nothing and values on the same line?

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
C

Craig Buchanan

I'm trying to deterime if an instance of an object exists and if so, if it
has a certain value. This syntax tosses an error:

If (Not LastItem Is Nothing) And LastItem.Cells(3).Text = Item.Cells(3).Text
Then Exit Sub

Other than having a nested If Then block, is there another way?



Thanks,



Craig Buchanan
 
Craig said:
I'm trying to deterime if an instance of an object exists and if so, if it
has a certain value. This syntax tosses an error:

If (Not LastItem Is Nothing) And LastItem.Cells(3).Text = Item.Cells(3).Text
Then Exit Sub

Other than having a nested If Then block, is there another way?



Thanks,



Craig Buchanan

Replace And with AndAlso...that keyword only executes the next
expression if the first one is true

Its counterpart is OrElse
 
Craig said:
I'm trying to deterime if an instance of an object exists and if so, if it
has a certain value. This syntax tosses an error:

If (Not LastItem Is Nothing) And LastItem.Cells(3).Text = Item.Cells(3).Text
Then Exit Sub

Other than having a nested If Then block, is there another way?



Thanks,



Craig Buchanan

Replace And with AndAlso...that keyword only executes the next
expression if the first one is true

Its counterpart is OrElse
 
Back
Top