![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Jan 2002
Posts: 1
|
Is there any way of comparing Excel sheets? I want to compare similar sheets prepared on two computers and have any differences highlighted in some way. I know this can be done in text files, but I can't see how it is done in Excel.
Regards Bigchips |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Try the following:
Sub CheckWS() Dim Sheet1rng, Sheet2rng As Range Set Sheet1rng = Worksheets("Sheet1").UsedRange Set Sheet2rng = Worksheets("Sheet2").UsedRange For cell = 1 To Sheet1rng.Cells.Count If Sheet1rng(cell) <> Worksheets("Sheet2").Range(Sheet1rng(cell).Address) Then Sheet1rng(cell).Interior.ColorIndex = 3 Next cell For cell = 1 To Sheet2rng.Cells.Count If Sheet2rng(cell) <> Worksheets("Sheet1").Range(Sheet2rng(cell).Address) Then Worksheets("Sheet1").Range(Sheet2rng(cell).Address).Interior.ColorIndex = 3 Next cell End Sub It will highlight in red all the cells on Sheet1 that are not equal to cells on Sheet2.
__________________
Kind regards, Al Chara |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|