Hi kingsdime29x- Here's a macro to handle your validation. It opens your 'XXX...Lakers' WBs one at a time, runs a comparison, and closes them. I've included instructions in the attached workbook. Let me know if you have any problems. -Lee
ps. If this does the trick, please mark the thread as SOLVED (Thread Tools, up top)... and perhaps click the Add Reputation star at the bottom of this post. Thanks!
for the browsers:
Sub CompareStats()
''''''''''''''''''' LLN 2017-04-21 '''''''''''''''''''''''
Dim rw As Long, indx As Long, cnt As Long, errRow As Long, errCnt As Long
Dim player As String, statsLAL As Range, statsBS As Range, found As Range
Dim folderpath As String, WBLAL As String, WS As Worksheet
Application.ScreenUpdating = False
ThisWorkbook.Activate
folderpath = Application.ThisWorkbook.Path & "\"
For cnt = 1 To ThisWorkbook.Worksheets.Count
Set WS = Worksheets(cnt)
WBLAL = WS.Name & ".xlsx"
Workbooks.Open folderpath & WBLAL
WS.Activate
With Workbooks(WBLAL).Worksheets(Left(WS.Name, 7) & " Stats") '1989-90 Stats
errRow = Cells(2, 2).End(xlDown).Row + 2
Range("A1:P1").Copy Destination:=Cells(errRow, 1)
For rw = 2 To Cells(2, 2).End(xlDown).Row
player = Cells(rw, 2).Value
Set found = .Range("B:B").Find(player)
If found Is Nothing Then
errRow = errRow + 1
errCnt = errCnt + 1
Cells(errRow, 2) = player & " NOT FOUND"
Else
Set statsBS = Range("C1:P1").Offset(rw - 1)
Set statsLAL = .Range("D1:Q1").Offset(found.Offset(, 1).End(xlDown).Row - 1)
For indx = 1 To 14
If statsBS.Cells(1, indx).Value <> statsLAL.Cells(1, indx).Value Then
errRow = errRow + 1
errCnt = errCnt + 1
Cells(errRow, 2).Value = player
Cells(errRow, indx + 2).Value = statsLAL.Cells(1, indx).Value
End If
Next
End If
Next
End With
Workbooks(WBLAL).Close SaveChanges:=False
Next
Application.ScreenUpdating = True
Beep
MsgBox "All done. " & errCnt & " errors were found.", , "CompareStats macro"
End Sub
Bookmarks