compare books macro

B

bill

i have a macro that creates a book then creates an update book
i am trying to compare col C and col F in sheet1 with col C and col F in
sheet 1 of update book.
if there is an increase of a 100 or more in any cell in col C or F send
alert and copy sheets to sheet 1&2 of "test" workbook
what is wrong with the following. or how would i write the macro.

Sub Compare()
For i = 1 To Workbooks("Old").ActiveSheet.UsedRange.Rows.Count
If Workbooks("Old").ActiveSheet.Cells(i, "C") -
Workbooks("New").ActiveSheet.Cells(i, "C") >= 100 Then
MsgBox Workbooks("Old").ActiveSheet.Cells(i, "C") & "changed by more then
100", , "Alert"
End If
Next
End Sub

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top