ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How I can compare numbers in one book to another book (https://www.excelbanter.com/excel-programming/291986-how-i-can-compare-numbers-one-book-another-book.html)

timppa

How I can compare numbers in one book to another book
 
How I can make macro to compare numbers in one book with another book ?

Tom Ogilvy

How I can compare numbers in one book to another book
 
set sh1 = Workbooks(1).Worksheets(1)
set sh2 = Workbooks(2).Worksheets(1)
sh1.copy
sh2.cells.copy
Activesheet.Cells.PasteSpecial paste:=Values, operation:=xlSubtract

You could repeat for each matching sheet or reverse which sheet is
subtracted to get the correct "sense" of the difference (positive or
negative changes).

--
Regards,
Tom Ogilvy

"timppa" wrote in message
...
How I can make macro to compare numbers in one book with another book ?





All times are GMT +1. The time now is 05:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com