Hi All,
I was wondering what would be the most efficient way in comparing two workbooks, highlighting the changes, then consolidating the information into a new workbook. What I mean by changes is whether or not there were any changes made to columns B, E, or I from last months deadline list. I am not great at VBA, but I have pieced together some code below.
Option Explicit
Sub TrackChangesQC()
Dim wbkA As Workbook
Dim wbkB As Workbook
Dim varSheetA As Variant
Dim varSheetB As Variant
Dim strRangeToCheck As String
Dim iRow As Long
Dim iCol As Long
Set wbkA = Workbooks.Open(Filename:="Y\PGA_staff\ShafranAY\Production\GA_monthly_deadlines_master_archives\GA_monthly_deadlines_master_0712SRI")
Set wbkB = Workbooks.Open(Filename:="Y\PGA_staff\ShafranAY\Production\GA_monthly_deadlines_master_archives\GA_monthly_deadlines_master_0612SRIGA_monthly_deadlines_master_0712SRI.xlsGA_monthly_deadlines_master_0612SRI.xls")
strRangeToCheck = "A1:AB10000"
Debug.Print Now
varSheetA = Worksheets("Master").Range(strRangeToCheck)
varSheetB = wbkB.Worksheets("Master").Range(strRangeToCheck)
Debug.Print Now
For iRow = LBound(varSheetA, 1) To UBound(varSheetA, 1)
For iCol = LBound(varSheetA, 2) To UBound(varSheetA, 2)
If varSheetA(iRow, iCol) = varSheetB(iRow, iCol) Then
'Cells are identical
'Do nothing
Else
'Cells are different
'Highlight the changes, consolidate the rows and move them into a new workbook
End If
Next iCol
Next iRow
End Sub
Attached are the sample files I am working with as well if it helps you get a better idea of the situation at hand.
If anyone would be able to give me some advice and/or help I would greatly appreciate it.
Bookmarks