'********************************************************************************************************** ' Name: isTheSameSheet ' Author: mielk | 2012-03-26 ' ' Comment: Function checks if two variables of Worksheet type refer to the same ' Excel worksheet. ' ' Parameters: ' aSheet, bSheet Excel worksheets to be compared. Order doesn't matter. ' ' Returns: ' Boolean True - if both variables refer to the same Excel worksheet. ' False - if the given variables refer to other Excel worksheets. ' ' ' --- Changes log ----------------------------------------------------------------------------------------- ' 2012-03-26 mielk Function created. '********************************************************************************************************** Public Function isTheSameSheet(aSheet As Excel.Worksheet, bSheet As Excel.Worksheet) As Boolean Const METHOD_NAME As String = "isTheSameSheet" '------------------------------------------------------------------------------------------------------ isTheSameSheet = (VBA.ObjPtr(aSheet) = VBA.ObjPtr(bSheet)) End Function