○○○○○○○○○○○○○○○○○
Sub aaa()


    '●判定結果の文字と色の設定
    Dim markOK As String: markOK = "○"
    Dim markNG As String: markNG = "×"
    Dim colorNG As String: colorNG = "&H00FFFF"
    Dim colorMidasi As String: colorMidasi = "&HFFE4B5"
    Dim colorHantei As String: colorHantei = "&HFFB6FF"
    
    
    '●シート指定
    Dim compSheet1 As Integer: compSheet1 = 1 '比較元
    Dim compSheet2 As Integer: compSheet2 = 2 '比較先
    Dim hanteiSheet As Integer: hanteiSheet = 3 'セルの比較結果
    Dim saiSheet As Integer: saiSheet = 4 'NGセルの比較文字
    
    Dim row As Integer: row = 1
    Dim col As Integer: col = 1
    Dim HanteiRow  As Integer: HanteiRow = 1

    'シートのクリア
    Worksheets(hanteiSheet).Cells.Clear
    Worksheets(saiSheet).Cells.Clear

    'シート内の比較範囲
    MaxRow = Worksheets(compSheet1).Range("A1").SpecialCells(xlLastCell).row
    MaxRow2 = Worksheets(compSheet2).Range("A1").SpecialCells(xlLastCell).row
    If MaxRow < MaxRow2 Then
        MaxRow = MaxRow2
    End If

    MaxCol = Worksheets(compSheet1).Range("A1").SpecialCells(xlLastCell).Column
    MaxCol2 = Worksheets(compSheet2).Range("A1").SpecialCells(xlLastCell).Column
    If MaxCol < MaxCol2 Then
        MaxCol = MaxCol2
    End If

    '比較処理
    For col = 1 To MaxCol
        
        For row = 1 To MaxRow
            
            comp1 = Worksheets(compSheet1).Cells(row, col)
            comp2 = Worksheets(compSheet2).Cells(row, col)
            
            If comp1 <> comp2 Then
                
                keka = markNG
                Worksheets(compSheet1).Cells(row, col).Interior.Color = colorNG
                Worksheets(compSheet2).Cells(row, col).Interior.Color = colorNG
                
                With Worksheets(saiSheet).Cells(HanteiRow, 1)
                    .Hyperlinks.Add Anchor:=Worksheets(saiSheet).Cells(HanteiRow, 1), _
                                    Address:="##'" & Worksheets(compSheet1).Name & "'!R" & row & "C" & col
                    .Value = "link"
                    .Interior.Color = colorMidasi
                End With
                With Worksheets(saiSheet).Cells(HanteiRow, 2)
                    .Hyperlinks.Add Anchor:=Worksheets(saiSheet).Cells(HanteiRow, 2), _
                                    Address:="##'" & Worksheets(compSheet2).Name & "'!R" & row & "C" & col
                    .Value = "link"
                    .Interior.Color = colorMidasi
                End With
                
                With Worksheets(saiSheet).Cells(HanteiRow, 3)
                    .Value = Worksheets(compSheet1).Cells(1, col)
                    .Interior.Color = colorMidasi
                End With
                If comp1 <> 0 Then
                    Worksheets(saiSheet).Cells(HanteiRow, 4).Value = comp1
                End If
                If comp2 <> 0 Then
                    Worksheets(saiSheet).Cells(HanteiRow, 5).Value = comp2
                End If
                
                HanteiRow = HanteiRow + 1
            Else
                keka = markOK
                Worksheets(compSheet1).Cells(row, col).Interior.ColorIndex = 0
                Worksheets(compSheet2).Cells(row, col).Interior.ColorIndex = 0
            End If
            
            With Worksheets(hanteiSheet).Cells(row, col)
                .Value = keka
                .HorizontalAlignment = xlCenter
                If keka = markNG Then
                    .Interior.Color = colorHantei
                    .Font.Bold = True
                End If
            End With

        Next

        If row >= MaxRow Then
            '列集計
            Worksheets(hanteiSheet).Cells(row, col).FormulaR1C1 = _
                "=COUNTIF(R" & 1 & "C" & col & ":R" & row - 1 & "C" & col & ",""" & markNG & """)"
                Worksheets(hanteiSheet).Cells(row, col).Interior.Color = colorMidasi
        End If

    Next

    For row = 1 To MaxRow
        '行集計
        Worksheets(hanteiSheet).Cells(row, col).FormulaR1C1 = _
            "=COUNTIF(R" & row & "C" & 1 & ":R" & row & "C" & MaxCol & ",""" & markNG & """)"
            Worksheets(hanteiSheet).Cells(row, col).Interior.Color = colorMidasi
    Next


End Sub



○○○○○○○○○○○○○○○○○
Sub aaa()

    '●判定結果の文字と色の設定
    Dim markOK As String: markOK = "○"
    Dim markNG As String: markNG = "×"
    Dim colorNG As String: colorNG = "&H00FFFF"
    
    '●シート指定
    Dim compSheet1 As Integer: compSheet1 = 1 '比較元
    Dim compSheet2 As Integer: compSheet2 = 2 '比較先
    Dim hanteiSheet As Integer: hanteiSheet = 3 'セルの比較結果
    Dim saiSheet As Integer: saiSheet = 4 'NGセルの比較文字
    
    Dim row As Integer: row = 1
    Dim col As Integer: col = 1
    Dim HanteiRow  As Integer: HanteiRow = 1

    'シートのクリア
    Worksheets(hanteiSheet).Cells.Clear
    Worksheets(saiSheet).Cells.Clear

    'シート内の比較範囲
    MaxRow = Worksheets(compSheet1).Range("A1").SpecialCells(xlLastCell).row
    MaxRow2 = Worksheets(compSheet2).Range("A1").SpecialCells(xlLastCell).row
    If MaxRow < MaxRow2 Then
        MaxRow = MaxRow2
    End If

    MaxCol = Worksheets(compSheet1).Range("A1").SpecialCells(xlLastCell).Column
    MaxCol2 = Worksheets(compSheet2).Range("A1").SpecialCells(xlLastCell).Column
    If MaxCol < MaxCol2 Then
        MaxCol = MaxCol2
    End If

    '比較処理
    For i = 1 To MaxRow
        
        col = 1
        
        For j = 1 To MaxCol
            
            comp1 = Worksheets(compSheet1).Cells(row, col)
            comp2 = Worksheets(compSheet2).Cells(row, col)
            
            If comp1 <> comp2 Then
                keka = markNG
            
                Worksheets(compSheet1).Cells(row, col).Interior.Color = colorNG
                Worksheets(compSheet2).Cells(row, col).Interior.Color = colorNG
                           
                If comp1 <> 0 Then
                    Worksheets(saiSheet).Cells(HanteiRow, 2).Value = comp1
                End If
                If comp2 <> 0 Then
                    Worksheets(saiSheet).Cells(HanteiRow, 3).Value = comp2
                End If
                HanteiRow = HanteiRow + 1
            Else
                keka = markOK
            End If
            Worksheets(hanteiSheet).Cells(row, col).Value = keka

            col = col + 1

        Next

        If i <= MaxRow Then
            '行集計
            Worksheets(hanteiSheet).Cells(row, col).FormulaR1C1 = _
                "=COUNTIF(R" & row & "C" & 1 & ":R" & row & "C" & col - 1 & "," & markNG & ")"
        End If

        row = row + 1

    Next

    For col = 1 To MaxCol
        '列集計
        Worksheets(hanteiSheet).Cells(row, col).FormulaR1C1 = _
            "=COUNTIF(R" & 1 & "C" & col & ":R" & row - 1 & "C" & col & "," & markNG & ")"
    Next

End Sub



















○○○○○○○○○○○○○○○○○
Sub aaa()
 
 FileName = "aaa.xlsm"
 
 pt = ThisWorkbook.Path & "\"
 fn = Dir(ThisWorkbook.Path & "\*.xls", vbNormal)
 Do While fn <> ""
    Call bbb(pt, fn)
    
    fn = Dir()
 Loop
 
End Sub

Function bbb(ByVal pt As String, ByVal fn As String)
 Dim row, col As Integer
 Dim row2, col2 As Integer
 
 row = 1
 col = 1
 row2 = 1
 col2 = 1
 
 Worksheets(4).Cells.Clear
 
 MaxRow = Worksheets(1).Range("A1").SpecialCells(xlLastCell).row
 MaxCol = Worksheets(1).Range("A1").SpecialCells(xlLastCell).Column
 For i = 1 To MaxRow
    col = 1
    For j = 1 To MaxCol
        comp1 = ExecuteExcel4Macro("'" & pt & "\[" & fn & "]1'!R" & row & "C" & col)
        comp2 = ExecuteExcel4Macro("'" & pt & "\[" & fn & "]2'!R" & row & "C" & col)
        
        If comp1 <> comp2 Then
            keka = "×"
        
            Worksheets(1).Cells(row, col).Interior.Color = "&H00FFFF"
            Worksheets(2).Cells(row, col).Interior.Color = "&H00FFFF"
                       
            If comp1 <> 0 Then
                Worksheets(4).Cells(row2, 2).Value = comp1
            End If
            If comp2 <> 0 Then
                Worksheets(4).Cells(row2, 3).Value = comp2
            End If
            row2 = row2 + 1
        Else
            keka = "○"
        End If
        Worksheets(3).Cells(row, col).Value = keka
        
        col = col + 1
    Next
    row = row + 1
 Next
  
End Function