Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I get the macro from GS, it is about compare "account number" column (column K) in two workbooks, if it is matched account number, column L to N data will be copy from week1 unknown sor to week2 unknown sor.xls). May I ask how to modify the macro, therefore, not all matched account number, copy data of column L to N from week 1 excel to week 2 excel? For example, selection criteria is column k ( column k, it has several choice: week 1 , week 2, week 3...) The code and file as following: https://rapidshare.com/files/4612445...wn_SOR_May.xls https://rapidshare.com/files/4612445...wn_sor_May.xls Sub CompareData_CustomerNewUpgrades() Dim rngSource As Range, rngTarget As Range, rng As Range Dim lLastRow As Long, lRow As Long, i As Integer Set rngTarget = Workbooks("week2 unknown SOR.xls").Sheets("Unknown Customer New Upgrade").Range("$l:$l") Set rngSource = ThisWorkbook.Sheets("Unknown Customer New Upgrade").Range("$l:$l") lLastRow = rngSource.Rows(rngSource.Rows.Count).End(xlUp).Row For lRow = 1 To lLastRow Set rng = rngTarget.Find(What:=rngSource.Cells(lRow), LookAt:=xlWhole) If Not rng Is Nothing Then For i = 1 To 2: rng.Offset(, i) = rngSource.Cells(lRow).Offset(, i): Next End If Next End Sub 'CompareData_CustomerNewUpgrades() Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
compare 2 column cells and return the adjacent columns cells data of the cell | Excel Worksheet Functions | |||
Macro to compare and copy ranges of cells | Excel Programming | |||
Compare 1 cell to column of cells returning adjacent cells info? | Excel Worksheet Functions | |||
Macro to compare, find match and copy between workbooks | Excel Programming | |||
compare two text and if equal copy adjacent data | Excel Worksheet Functions |