View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] rlaemmler@gmail.com is offline
external usenet poster
 
Posts: 16
Default Compare cells including formatting

Hi,

I need to compare 2 worksheets for cell differences using VBA. Beside
value comparison I also need to detect format differences. So far I
couldn't find any better way then comparing cell by cell and format
property by format property (see example below). This comparison works
find but is slow especially for large spreadsheets.

Does anybody know a more powerful way doing this?

Example:
-------------
With cell
If (.Value < originalWS.Cells(row, col).Value Or _
.Interior.color < originalWS.Cells(row,
col).Interior.color Or _
.Interior.Pattern < originalWS.Cells(row,
col).Interior.Pattern Or _
.Interior.PatternColor < originalWS.Cells(row,
col).Interior.PatternColor Or _
.Font.color < originalWS.Cells(row,
col).Font.color Or _
.Font.size < originalWS.Cells(row, col).Font.size
Or _
.Font.name < originalWS.Cells(row, col).Font.name
Or _
.Font.Strikethrough < originalWS.Cells(row,
col).Font.Strikethrough Or _
.Font.Superscript < originalWS.Cells(row,
col).Font.Superscript Or _
.Font.Subscript < originalWS.Cells(row,
col).Font.Subscript Or _
.Font.BOLD < originalWS.Cells(row, col).Font.BOLD
Or _
.Font.ITALIC < originalWS.Cells(row,
col).Font.ITALIC Or _
.Font.Underline < originalWS.Cells(row,
col).Font.Underline Or _
.HorizontalAlignment < originalWS.Cells(row,
col).HorizontalAlignment Or _
.VerticalAlignment < originalWS.Cells(row,
col).VerticalAlignment Or _
.............................
................................


Cheers,
Reto
www.xcellery.com