Results 1 to 6 of 6

Why aren't values being transcribed?

Threaded View

  1. #1
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Why aren't values being transcribed?

    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 interest
    ' 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
    So I have two initial issues.
    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.
    Attached Files Attached Files
    Last edited by ChemistB; 07-26-2011 at 10:29 AM. Reason: Updated file with expected results
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1