excel vba if two cells are equal code example Example: vba check if two sheets are the same If sheet1 Is sheet2 Then Debug.Print("Same workbook")