Excel/Compare 2 spreadsheets and highlight differences
I have been to 2 of the conferences that you put on with Damon. I have your This isn't Excel it's Magic book, and I have searched the net trying to find my perfect solution (outside of an add on application which isn't an option at my office).
I have a report of employees for March and April, in alphabetical order. I am needing to compare the 2 reports and have it highlight all differences, preferably in a different spreadsheet.
I found something on conditional formatting that at least highlights the differences, but it doesn't appear to be giving me the correct results (I would expect that the items highlighted in March as not on April would also be highlighted on April, not found in March). I then looked for some VBA code and I found something that started to work, but because I could potentially have a new hire inserted into a row, the VBA code was highlighting everything after the new hire because they were now, no longer on the same row for comparison sake.
So I looked in your book, not there - so looked you up directly.
Here are the particulars:
Range April =$A$2:$O$974
Range March = =$A$2:$O$985
Tried conditional formatting with formula
For April =COUNTIF(March,A2)=0
For March =COUNTIF(April,A2)=0
Issues noted above.
VBA Code I found:
Call compareSheets("April", "March")
Sub compareSheets(shtApril As String, shtMarch As String)
Dim mycell As Range
Dim mydiffs As Integer
'For each cell in April that is not the same in March, color it yellow
For Each mycell In ActiveWorkbook.Worksheets(shtApril).UsedRange
If Not mycell.Value = ActiveWorkbook.Worksheets(shtMarch).Cells(mycell.Row, mycell.Column).Value Then
mycell.Interior.Color = vbYellow
mydiffs = mydiffs + 1
'Display a message box to demonstrate the differences
MsgBox mydiffs & " differences found", vbInformation
Issue: noted above
Basically I need to tell the reader of the report what employee had changes from one month to the next, and then what fields were changed. Again preferably on a separate report with just the changes.
Would you be able to help?
Looking forward to a favorable response.
I can help (thanks for finding me!) but it'd help ME if I could see an actual workbook - please send a sample to me at firstname.lastname@example.org, use subject of "AllExpersQ" and repeat what needs doing.
Also, note that there'll be another User conference Sept 25-27 in Las Vegas. If interested, let me know!