I'm comparing two worksheets within a workbook. WkSht1 and WkSht2 are strings entered through inputboxes for the worksheet names to be compared (in the example List1 and List 2).
The macro is assigning the proper range to WkSht1Range and entering those addresses in Col A of "Differences Sheet" but it is entering all addresses in the range and not recording any values in Columns B and C. Here's the code of interestSo I have two initial issues.![]()
' Process each cell For Each Cell In WkSht1Range 'Compare cells in two sheets with IF statement If Worksheets(WkSht1).Cell.Value <> Worksheets(WkSht2).Cell.Value Then With DifferencesSheet Cells(Row, 1) = Cell.Address _ (RowAbsolute:=False, ColumnAbsolute:=False) Cells(Row, 2) = Worksheets(WkSht1).Cell.Value Cells(Row, 3) = Worksheets(WkSht2).Cell.Value Row = Row + 1 End With End If Next Cell
1. Why all addresses and not just the ones where the two sheet values do not agree?
2. Why isn't it transcribing the sheet values?
Thanks in advance.
Workbook attached.











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks