Quote Originally Posted by shg View Post
Post your code, Mark.
Sub CompareDatesAcrossWorkbooks()

Dim Filename(5) As String
Dim tWB As Workbook, aWB As Workbook
Dim i As Integer, j As Integer, match As Integer, nomatch As _
Integer, nr As Integer, k As Integer
Dim Asset(5) As Workbook

Set tWB = ThisWorkbook
Set aWB = ActiveWorkbook 'Forgot this line

Columns("A:D").ClearContents

Filename(1) = "C:\Users\drkle\Desktop\Desktop Transfer Material\Stock Market\TradeStation\Correlation data\CLdata.csv"
Filename(2) = "C:\Users\drkle\Desktop\Desktop Transfer Material\Stock Market\TradeStation\Correlation data\GCdata.csv"
Filename(3) = "C:\Users\drkle\Desktop\Desktop Transfer Material\Stock Market\TradeStation\Correlation data\USdata.csv"
Filename(4) = "C:\Users\drkle\Desktop\Desktop Transfer Material\Stock Market\TradeStation\Correlation data\ECdata.csv"
Filename(5) = "C:\Users\drkle\Desktop\Desktop Transfer Material\Stock Market\TradeStation\Correlation data\ESdata.csv"

match = 0
nomatch = 0

For i = 1 To 5:
    Workbooks.Open Filename(i)
    'Set Asset(i) = Filename(i)
    Set Asset(i) = aWB
Next i

Range("A1").CurrentRegion.Select
nr = Selection.Rows.Count

For j = 2 To nr:
    If Asset(1).Cells(j, 1) = Asset(2).Cells(j, 1) _
    And Asset(2).Cells(j, 1) = Asset(3).Cells(j, 1) _
    And Asset(3).Cells(j, 1) = Asset(4).Cells(j, 1) _
    And Asset(4).Cells(j, 1) = Asset(5).Cells(j, 1) Then
        match = match + 1
    Else
        nomatch = nomatch + 1
    End If
Next j

For k = 1 To 5:
    Asset(i).Close SaveChanges:=False
Next k

Range("A1").Value = match 'Doesn't matter whether .Value is at the end
Range("A2") = nomatch

Range("B1") = "dates matched across all five WBs"
Range("B2") = "dates did not match across all five WBs"

End Sub