DRExcel515
Board Regular
- Joined
- Oct 20, 2017
- Messages
- 56
Okay I have two sheets in an excel file. Each sheet is from a different database dump that I need to compare and find differences between the two. In a perfect world I'd like to be able to copy and paste the values into the two sheets and have a macro that will sort the two separate sheets first A-Z in column A, then largest to smallest in column F. Then have the macro go through find any differences in the two sheets and highlight the differences. Lastly would it be possible to somehow after it has found the differences put all the rows with differences on the bottom and any without any highlighted differences on the top. I can do a little VBA and have a code that currently just highlights the differences (Pasted Below). Any help would be much appreciated!
Public Sub CompareSheets()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim cell As Range, rng As Range
Set ws1 = Worksheets("FA_Extract_Security_FADS")
Set ws2 = Worksheets("FA_Extract_security_Prod2")
Set rng = ws1.Range("A2:U5528")
For Each cell In rng
Celladdress = cell.Address
If cell <> ws2.Range(Celladdress) Then
cell.Interior.Color = vbYellow
ws2.Range(Celladdress).Interior.Color = vbYellow
End If
Next cell
End Sub
Public Sub CompareSheets()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim cell As Range, rng As Range
Set ws1 = Worksheets("FA_Extract_Security_FADS")
Set ws2 = Worksheets("FA_Extract_security_Prod2")
Set rng = ws1.Range("A2:U5528")
For Each cell In rng
Celladdress = cell.Address
If cell <> ws2.Range(Celladdress) Then
cell.Interior.Color = vbYellow
ws2.Range(Celladdress).Interior.Color = vbYellow
End If
Next cell
End Sub