R1 = Worksheets("sheet1").Cells(Rows.Count, "A").End(xlUp).Row "Compare " & ws1.Name & " with " & ws2.Name MsgBox DiffCount & " cells contain different formulas!", vbInformation, _ With Range(Cells(1, 1), Cells(maxR, maxC)) Sub CompareWorksheets(ws1 As Worksheet, ws2 As Worksheet)ĭim lr1 As Long, lr2 As Long, lc1 As Integer, lc2 As Integerĭim maxR As Long, maxC As Integer, cf1 As String, cf2 As StringĪpplication.StatusBar = "Creating the report."Ĭells(r, c).Formula = "'" & cf1 & " " & cf2Īpplication.StatusBar = "Formatting the report." Workbooks("WorkBookName.xls").Worksheets("Sheet2") ' CompareWorksheets ActiveWorkbook.Worksheets("Sheet1"), _ ' compare two different worksheets in two different workbooks ' compare two different worksheets in the active workbookĬompareWorksheets Worksheets("Sheet1"), Worksheets("Sheet2") Sh2cell.Offset(0, 1).Interior.ColorIndex = 6 If Sh2cell.Offset(0, 1) c.Offset(0, 1) Then Sh2cell.Offset(0, 1).Interior.ColorIndex = 3 Sh1cell.Offset(0, 1).Interior.ColorIndex = 6 If Sh1cell.Offset(0, 1) c.Offset(0, 1) Then ![]() Sh1cell.Offset(0, 1).Interior.ColorIndex = 3 Sht2.Cells(rowSht2, 1).Interior.ColorIndex = 3 Sht1.Cells(rowSht1, 1).Interior.ColorIndex = 3 If sht1.Cells(rowSht1, 1).Value = sht2.Cells(rowSht2, 1).Value Then ![]() If sht1.Cells(rowSht1, 1) = "" Then Exit Sub Str = InputBox("Type name of second sheet") Str = InputBox("Type name of first sheet") Sub FindDupes() 'assuming both sheets are in same book and book is open If Cell.Value Worksheets("CompareSheet#1").Range(Cell.Address) Thenįor Each Cell In Worksheets("CompareSheet#1").Range("A1:J50")įor Each Cell In Worksheets("CompareSheet#2").Range("A1:J50") If Cell.Value Worksheets("CompareSheet#2").Range(Cell.Address) Thenįor Each Cell In Worksheets("CompareSheet#2").UsedRange Here are a few ideas to compare SHEETS (not files).įor Each Cell In Worksheets("CompareSheet#1").UsedRange
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |