Please find the code below,
Sub Compare_WB_test()
Dim sh As Integer, ShName As String, C_Idx As Long, D_Idx As Long, ssh As String
Dim WB_1 As Workbook, WB_2 As Workbook, statmsg As String, limitcnt As Long
Dim idxRow As Double, idxCol As Double, idxRow_Cnt As Double, idxCol_Cnt As Double
Dim File_1 As String, File_2 As String, WB1_Data As Variant, WB2_Data As Variant
'Assign the Workbook
File_1 = ThisWorkbook.Sheets("Home").Cells(2, 2)
File_2 = ThisWorkbook.Sheets("Home").Cells(3, 2)
idxRow_Cnt = ThisWorkbook.Sheets("Home").Cells(4, 2)
idxCol_Cnt = ThisWorkbook.Sheets("Home").Cells(5, 2)
C_Idx = ThisWorkbook.Sheets("Home").Cells(6, 2).Interior.ColorIndex
'Open Files
Set WB_2 = Workbooks.Open(File_2)
Set WB_1 = Workbooks.Open(File_1)
ThisWorkbook.Sheets("Home").Cells(7, 2) = "Number of Sheets Found# " & WB_1.Sheets.Count
'Read Data
D_Idx = 1
limitcnt = 1
ThisWorkbook.Sheets("Comparison report").Cells.Clear
ThisWorkbook.Sheets("Comparison report").Cells(D_Idx, 2) = WB_1.Name
ThisWorkbook.Sheets("Comparison report").Cells(D_Idx, 3) = WB_2.Name
ThisWorkbook.Sheets("Comparison report").Activate
statmsg = Application.StatusBar
For sh = 1 To WB_1.Sheets.Count
ShName = WB_1.Sheets(sh).Name
ThisWorkbook.Sheets("Home").Cells(7 + sh, 1) = ShName
ThisWorkbook.Sheets("Home").Cells(7 + sh, 2) = "Identical"
ThisWorkbook.Sheets("Home").Cells(7 + sh, 2).Interior.Color = vbGreen
Application.StatusBar = statmsg & " ,Processing: " & ssh
If ThisWorkbook.Sheets("Home").Cells(4, 2) = 0 Then idxRow_Cnt = WB_1.Sheets(ShName).Range("A:A").SpecialCells(xlLastCell).Row
If ThisWorkbook.Sheets("Home").Cells(5, 2) = 0 Then idxCol_Cnt = WB_1.Sheets(ShName).Range("A:A").SpecialCells(xlLastCell).Column
For idxRow = 1 To idxRow_Cnt
For idxCol = 1 To idxCol_Cnt
WB1_Data = WB_1.Sheets(ShName).Cells(idxRow, idxCol)
WB2_Data = WB_2.Sheets(ShName).Cells(idxRow, idxCol)
'Compare Data
If WB1_Data <> WB2_Data Then
WB_1.Sheets(ShName).Cells(idxRow, idxCol).Interior.ColorIndex = C_Idx
ThisWorkbook.Sheets("Home").Cells(7 + sh, 2) = "Mismatch Found"
ThisWorkbook.Sheets("Home").Cells(7 + sh, 2).Interior.ColorIndex = C_Idx
If ssh <> WB_1.Sheets(sh).Name Then
D_Idx = D_Idx + 1
ThisWorkbook.Sheets("Comparison report").Cells(D_Idx, 2) = WB_1.Sheets(sh).Name
ThisWorkbook.Sheets("Comparison report").Cells(D_Idx, 3) = WB_2.Sheets(sh).Name
ssh = WB_1.Sheets(sh).Name
End If
D_Idx = D_Idx + 1
ThisWorkbook.Sheets("Comparison report").Cells(D_Idx, 1) = WB_1.Sheets(ShName).Cells(idxRow, idxCol).Address
ThisWorkbook.Sheets("Comparison report").Cells(D_Idx, 2) = WB1_Data
ThisWorkbook.Sheets("Comparison report").Cells(D_Idx, 3) = WB2_Data
ThisWorkbook.Sheets("Comparison report").Cells(D_Idx, 2).Select
End If
Next idxCol
Next idxRow
ThisWorkbook.Sheets("Home").Cells(7 + sh, 2) = ThisWorkbook.Sheets("Home").Cells(7 + sh, 2) & " (" & idxRow_Cnt & "-Rows , " & idxCol_Cnt & "-Cols Compared)"
Next sh
Limit_Exit:
End Sub