+ Reply to Thread
Results 1 to 2 of 2

Compare two columns in different excelsheet using vbscript macro

  1. #1
    Registered User
    Join Date
    11-05-2012
    Location
    vellore
    MS-Off Ver
    Excel 2003
    Posts
    2

    Compare two columns in different excelsheet using vbscript macro

    Hi

    I need to compare two columns in different excel sheet.lyk Workbook1->sheet1->Column A with another workbook Workbook2->Sheet1->Column A and if the values in the two columns matches the value of Workbook2->sheet1>Column C values should be copied into Workbook1->sheet1->ColumnC..

    Sub COMPARISON()
    Dim RC, RC1
    Dim W2 As Workbook ' , W1 As Workbook
    Dim i As Long, j As Long

    'Set W1 = Workbooks.Open("D:\SM\SM.xlsm")
    Set W2 = Workbooks.Open("D:\SM\SM1.xlsm")

    For Each RC In Range("A1")

    If RC = ActiveWorkbook.Sheets(4).Range("A1").Value Then _
    Set RC1 = ActiveWorkbook.Sheets("Sheet4").Range("C1").Value
    Range("C1").Value = RC1
    Next


    End Sub

    I have tried my level best with this code.but i didnt the exact result which i need .Can Anyone plz help to overcome this problem.


    Thanks in advance

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare two columns in different excelsheet using vbscript macro

    I do not know if this works, but have a go

    Please Login or Register  to view this content.
    Or this one

    Please Login or Register  to view this content.
    Last edited by AB33; 12-03-2012 at 10:12 AM.

+ Reply to Thread

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