Results 1 to 3 of 3

Compare two sheets and perform action routine

Threaded View

  1. #1
    Registered User
    Join Date
    12-22-2005
    Location
    Sarasota, FL
    Posts
    26

    Unhappy Compare two sheets and perform action routine

    I'm trying to compare two sheets with a routine.
    The intention is that if it finds a duplicate then it will place a comment on another column...
    I am not sure what I'm doing wrong but it does not seem to be doing anything.
    BTW this is a routine from the microsoft website that I modified slightly to meet my needs.

    Here's the routine...
    'Compare Query Report vs State Reject Report
    Dim iListCount As Integer
    Dim iCtr As Integer
    Dim lastrowquery As Integer
    Dim lastrowreport As Integer
    lastrowquery = Sheets("Query Report").Range("A1").End(xlDown).Row
    lastrowreport = Sheets("Sheet2").Range("A6").End(xlDown).Row
    ' Get count of records to search through (list that will have tags).
    iListCount = Sheets("Sheet2").Range("C1:C" & lastrowreport).Rows.Count
    ' Loop through the Query Report list.
    For Each x In Sheets("Query Report").Range("C1:C" & lastrowquery)
    ' Loop through all records in the second list.
    For iCtr = 1 To iListCount
    ' Do comparison of next record.
    ' To specify a different column, change 1 to the column number.
    If x.Value = Sheets("Sheet2").Cells(iCtr, 9).Value Then
    ' If match is true then tag with No Change.
    Sheets("Sheet2").Cells(iCtr, 9).FormulaR1C1 = "No Change"
    ' Increment counter to account for deleted row.
    iCtr = iCtr + 1
    End If
    Next iCtr
    Next

    The purpose is to compare Column C of two sheets and if both are the same then put a value on Column I of Sheet2.

    Any help would be appreciated...
    Last edited by wayliff; 01-16-2006 at 03:41 PM.

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