Is operator : IS « Data Type « VBA / Excel / Access / Word






Is operator

 
Sub obtest()
  Dim a, b
  Set a = Sheets(1)
  Set b = Sheets(1)
  If a Is b Then
    Debug.Print "Is works correctly; a and b reference the same object"
  Else
    Debug.Print "Is doesn't work."
  End If
  Debug.Print TypeName(a), TypeName(b)  'returns "Sheet"
  Debug.Print a.Name, b.Name            'returns the sheet name
End Sub

 








Related examples in the same category